Skip to content

Commit 6959cb5

Browse files
committed
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.
1 parent 10a5e33 commit 6959cb5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/catalog/information_schema.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2003-2007, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.39 2007/01/05 22:19:24 momjian Exp $
7+
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.40 2007/01/16 18:32:26 tgl Exp $
88
*/
99

1010
/*
@@ -964,10 +964,10 @@ CREATE VIEW key_column_usage AS
964964
AND r.relkind = 'r'
965965
AND (NOT pg_is_other_temp_schema(nr.oid))
966966
AND (pg_has_role(r.relowner, 'USAGE')
967-
OR has_table_privilege(c.oid, 'SELECT')
968-
OR has_table_privilege(c.oid, 'INSERT')
969-
OR has_table_privilege(c.oid, 'UPDATE')
970-
OR has_table_privilege(c.oid, 'REFERENCES')) ) AS ss
967+
OR has_table_privilege(r.oid, 'SELECT')
968+
OR has_table_privilege(r.oid, 'INSERT')
969+
OR has_table_privilege(r.oid, 'UPDATE')
970+
OR has_table_privilege(r.oid, 'REFERENCES')) ) AS ss
971971
WHERE ss.roid = a.attrelid
972972
AND a.attnum = (ss.x).x
973973
AND NOT a.attisdropped;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy