aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-01-16 18:32:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-01-16 18:32:26 +0000
commit6959cb59573975cc5b2913c0c3b97b5de5e3b56c (patch)
tree7557c0b54c5edf73dce53915666c1dbee371e8b7 /src
parent10a5e3348eabc651fe89e93ec37bdbaefeba7a12 (diff)
downloadpostgresql-6959cb59573975cc5b2913c0c3b97b5de5e3b56c.tar.gz
postgresql-6959cb59573975cc5b2913c0c3b97b5de5e3b56c.zip
Fix incorrect permissions check in information_schema.key_column_usage view:
it was checking a pg_constraint OID instead of pg_class OID, resulting in "relation with OID nnnnn does not exist" failures for anyone who wasn't owner of the table being examined. Per bug #2848 from Laurence Rowe. Note: for existing 8.2 installations a simple version update won't fix this; the easiest fix is to CREATE OR REPLACE this view with the corrected definition.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/information_schema.sql10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql
index 3393f01f8ba..a41801b5ac7 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -4,7 +4,7 @@
*
* Copyright (c) 2003-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.39 2007/01/05 22:19:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.40 2007/01/16 18:32:26 tgl Exp $
*/
/*
@@ -964,10 +964,10 @@ CREATE VIEW key_column_usage AS
AND r.relkind = 'r'
AND (NOT pg_is_other_temp_schema(nr.oid))
AND (pg_has_role(r.relowner, 'USAGE')
- OR has_table_privilege(c.oid, 'SELECT')
- OR has_table_privilege(c.oid, 'INSERT')
- OR has_table_privilege(c.oid, 'UPDATE')
- OR has_table_privilege(c.oid, 'REFERENCES')) ) AS ss
+ OR has_table_privilege(r.oid, 'SELECT')
+ OR has_table_privilege(r.oid, 'INSERT')
+ OR has_table_privilege(r.oid, 'UPDATE')
+ OR has_table_privilege(r.oid, 'REFERENCES')) ) AS ss
WHERE ss.roid = a.attrelid
AND a.attnum = (ss.x).x
AND NOT a.attisdropped;