44 *
55 * Copyright (c) 2003-2006, PostgreSQL Global Development Group
66 *
7- * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.36 2006/09/05 21:08:35 tgl Exp $
7+ * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.37 2006/09/14 22:05:06 tgl Exp $
88 */
99
1010/*
@@ -644,7 +644,8 @@ CREATE VIEW columns AS
644644 WHERE a .attrelid = c .oid
645645 AND a .atttypid = t .oid
646646 AND nc .oid = c .relnamespace
647- AND (nc .nspname NOT LIKE ' pg!_temp!_%' ESCAPE ' !' OR pg_catalog .pg_table_is_visible (c .oid ))
647+ AND (NOT pg_is_other_temp_schema(nc .oid ))
648+
648649 AND a .attnum > 0 AND NOT a .attisdropped AND c .relkind in (' r' , ' v' )
649650
650651 AND (pg_has_role(c .relowner , ' USAGE' )
@@ -940,7 +941,7 @@ CREATE VIEW key_column_usage AS
940941 AND nc .oid = c .connamespace
941942 AND c .contype IN (' p' , ' u' , ' f' )
942943 AND r .relkind = ' r'
943- AND (nr . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
944+ AND (NOT pg_is_other_temp_schema( nr .oid ))
944945 AND (pg_has_role(r .relowner , ' USAGE' )
945946 OR has_table_privilege(c .oid , ' SELECT' )
946947 OR has_table_privilege(c .oid , ' INSERT' )
@@ -1467,7 +1468,7 @@ CREATE VIEW sequences AS
14671468 FROM pg_namespace nc, pg_class c
14681469 WHERE c .relnamespace = nc .oid
14691470 AND c .relkind = ' S'
1470- AND (nc . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1471+ AND (NOT pg_is_other_temp_schema( nc .oid ))
14711472 AND (pg_has_role(c .relowner , ' USAGE' )
14721473 OR has_table_privilege(c .oid , ' SELECT' )
14731474 OR has_table_privilege(c .oid , ' UPDATE' ) );
@@ -1698,7 +1699,7 @@ CREATE VIEW table_constraints AS
16981699 WHERE nc .oid = c .connamespace AND nr .oid = r .relnamespace
16991700 AND c .conrelid = r .oid
17001701 AND r .relkind = ' r'
1701- AND (nr . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
1702+ AND (NOT pg_is_other_temp_schema( nr .oid ))
17021703 AND (pg_has_role(r .relowner , ' USAGE' )
17031704 -- SELECT privilege omitted, per SQL standard
17041705 OR has_table_privilege(r .oid , ' INSERT' )
@@ -1731,7 +1732,7 @@ CREATE VIEW table_constraints AS
17311732 AND a .attnum > 0
17321733 AND NOT a .attisdropped
17331734 AND r .relkind = ' r'
1734- AND (nr . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
1735+ AND (NOT pg_is_other_temp_schema( nr .oid ))
17351736 AND (pg_has_role(r .relowner , ' USAGE' )
17361737 OR has_table_privilege(r .oid , ' SELECT' )
17371738 OR has_table_privilege(r .oid , ' INSERT' )
@@ -1806,7 +1807,7 @@ CREATE VIEW tables AS
18061807 CAST(c .relname AS sql_identifier) AS table_name,
18071808
18081809 CAST(
1809- CASE WHEN nc .nspname LIKE ' pg!_temp!_% ' ESCAPE ' ! ' THEN ' LOCAL TEMPORARY'
1810+ CASE WHEN nc .oid = pg_my_temp_schema() THEN ' LOCAL TEMPORARY'
18101811 WHEN c .relkind = ' r' THEN ' BASE TABLE'
18111812 WHEN c .relkind = ' v' THEN ' VIEW'
18121813 ELSE null END
@@ -1823,15 +1824,15 @@ CREATE VIEW tables AS
18231824 THEN ' YES' ELSE ' NO' END AS character_data) AS is_insertable_into,
18241825 CAST(' NO' AS character_data) AS is_typed,
18251826 CAST(
1826- CASE WHEN nc .nspname LIKE ' pg!_temp!_% ' ESCAPE ' ! ' THEN ' PRESERVE'
1827+ CASE WHEN nc .oid = pg_my_temp_schema() THEN ' PRESERVE' -- FIXME
18271828 ELSE null END
18281829 AS character_data) AS commit_action
18291830
18301831 FROM pg_namespace nc, pg_class c
18311832
18321833 WHERE c .relnamespace = nc .oid
18331834 AND c .relkind IN (' r' , ' v' )
1834- AND (nc . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1835+ AND (NOT pg_is_other_temp_schema( nc .oid ))
18351836 AND (pg_has_role(c .relowner , ' USAGE' )
18361837 OR has_table_privilege(c .oid , ' SELECT' )
18371838 OR has_table_privilege(c .oid , ' INSERT' )
@@ -1952,7 +1953,7 @@ CREATE VIEW triggers AS
19521953 AND c .oid = t .tgrelid
19531954 AND t .tgtype & em .num <> 0
19541955 AND NOT t .tgisconstraint
1955- AND (n . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1956+ AND (NOT pg_is_other_temp_schema( n .oid ))
19561957 AND (pg_has_role(c .relowner , ' USAGE' )
19571958 -- SELECT privilege omitted, per SQL standard
19581959 OR has_table_privilege(c .oid , ' INSERT' )
@@ -2150,7 +2151,7 @@ CREATE VIEW views AS
21502151
21512152 WHERE c .relnamespace = nc .oid
21522153 AND c .relkind = ' v'
2153- AND (nc . nspname NOT LIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
2154+ AND (NOT pg_is_other_temp_schema( nc .oid ))
21542155 AND (pg_has_role(c .relowner , ' USAGE' )
21552156 OR has_table_privilege(c .oid , ' SELECT' )
21562157 OR has_table_privilege(c .oid , ' INSERT' )
0 commit comments