Skip to content

Commit 395c816

Browse files
committed
Sequences were not being shown due to the use of lowercase 's' instead
of 'S', and the views were not checking for table visibility with regards to temporary tables and sequences. Greg Sabino Mullane
1 parent 19dd2fb commit 395c816

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/catalog/information_schema.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2003-2006, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.33 2006/04/02 17:38:13 petere Exp $
7+
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.34 2006/09/04 21:03:18 momjian Exp $
88
*/
99

1010
/*
@@ -644,7 +644,7 @@ CREATE VIEW columns AS
644644
WHERE a.attrelid = c.oid
645645
AND a.atttypid = t.oid
646646
AND nc.oid = c.relnamespace
647-
647+
AND (nc.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(c.oid))
648648
AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v')
649649

650650
AND (pg_has_role(c.relowner, 'USAGE')
@@ -933,6 +933,7 @@ CREATE VIEW key_column_usage AS
933933
AND nc.oid = c.connamespace
934934
AND c.contype IN ('p', 'u', 'f')
935935
AND r.relkind = 'r'
936+
AND (nr.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(r.oid))
936937
AND (pg_has_role(r.relowner, 'USAGE')
937938
OR has_table_privilege(c.oid, 'SELECT')
938939
OR has_table_privilege(c.oid, 'INSERT')
@@ -1459,7 +1460,8 @@ CREATE VIEW sequences AS
14591460
CAST(null AS character_data) AS cycle_option -- FIXME
14601461
FROM pg_namespace nc, pg_class c
14611462
WHERE c.relnamespace = nc.oid
1462-
AND c.relkind = 's'
1463+
AND c.relkind = 'S'
1464+
AND (nc.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(c.oid))
14631465
AND (pg_has_role(c.relowner, 'USAGE')
14641466
OR has_table_privilege(c.oid, 'SELECT')
14651467
OR has_table_privilege(c.oid, 'UPDATE') );
@@ -1690,6 +1692,7 @@ CREATE VIEW table_constraints AS
16901692
WHERE nc.oid = c.connamespace AND nr.oid = r.relnamespace
16911693
AND c.conrelid = r.oid
16921694
AND r.relkind = 'r'
1695+
AND (nr.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(r.oid))
16931696
AND (pg_has_role(r.relowner, 'USAGE')
16941697
-- SELECT privilege omitted, per SQL standard
16951698
OR has_table_privilege(r.oid, 'INSERT')
@@ -1723,6 +1726,7 @@ CREATE VIEW table_constraints AS
17231726
AND a.attnum > 0
17241727
AND NOT a.attisdropped
17251728
AND r.relkind = 'r'
1729+
AND (nr.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(r.oid))
17261730
AND (pg_has_role(r.relowner, 'USAGE')
17271731
OR has_table_privilege(r.oid, 'SELECT')
17281732
OR has_table_privilege(r.oid, 'INSERT')
@@ -1824,6 +1828,7 @@ CREATE VIEW tables AS
18241828

18251829
WHERE c.relnamespace = nc.oid
18261830
AND c.relkind IN ('r', 'v')
1831+
AND (nc.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(c.oid))
18271832
AND (pg_has_role(c.relowner, 'USAGE')
18281833
OR has_table_privilege(c.oid, 'SELECT')
18291834
OR has_table_privilege(c.oid, 'INSERT')
@@ -1945,6 +1950,7 @@ CREATE VIEW triggers AS
19451950
AND c.oid = t.tgrelid
19461951
AND t.tgtype & em.num <> 0
19471952
AND NOT t.tgisconstraint
1953+
AND (n.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(c.oid))
19481954
AND (pg_has_role(c.relowner, 'USAGE')
19491955
-- SELECT privilege omitted, per SQL standard
19501956
OR has_table_privilege(c.oid, 'INSERT')
@@ -2143,6 +2149,7 @@ CREATE VIEW views AS
21432149

21442150
WHERE c.relnamespace = nc.oid
21452151
AND c.relkind = 'v'
2152+
AND (nc.nspname NOT LIKE 'pg!_temp!_%' ESCAPE '!' OR pg_catalog.pg_table_is_visible(c.oid))
21462153
AND (pg_has_role(c.relowner, 'USAGE')
21472154
OR has_table_privilege(c.oid, 'SELECT')
21482155
OR has_table_privilege(c.oid, 'INSERT')

0 commit comments

Comments
 (0)