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
644644WHERE a .attrelid = c .oid
645645AND a .atttypid = t .oid
646646AND nc .oid = c .relnamespace
647- AND (nc .nspname NOTLIKE ' pg!_temp!_%' ESCAPE' !' OR pg_catalog .pg_table_is_visible (c .oid ))
647+ AND (NOT pg_is_other_temp_schema(nc .oid ))
648+
648649AND a .attnum > 0 AND NOTa .attisdropped AND c .relkind in (' r' ,' v' )
649650
650651AND (pg_has_role(c .relowner ,' USAGE' )
@@ -940,7 +941,7 @@ CREATE VIEW key_column_usage AS
940941AND nc .oid = c .connamespace
941942AND c .contype IN (' p' ,' u' ,' f' )
942943AND r .relkind = ' r'
943- AND (nr . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
944+ AND (NOTpg_is_other_temp_schema( nr .oid ))
944945AND (pg_has_role(r .relowner ,' USAGE' )
945946OR has_table_privilege(c .oid ,' SELECT' )
946947OR has_table_privilege(c .oid ,' INSERT' )
@@ -1467,7 +1468,7 @@ CREATE VIEW sequences AS
14671468FROM pg_namespace nc, pg_class c
14681469WHERE c .relnamespace = nc .oid
14691470AND c .relkind = ' S'
1470- AND (nc . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1471+ AND (NOTpg_is_other_temp_schema( nc .oid ))
14711472AND (pg_has_role(c .relowner ,' USAGE' )
14721473OR has_table_privilege(c .oid ,' SELECT' )
14731474OR has_table_privilege(c .oid ,' UPDATE' ) );
@@ -1698,7 +1699,7 @@ CREATE VIEW table_constraints AS
16981699WHERE nc .oid = c .connamespace AND nr .oid = r .relnamespace
16991700AND c .conrelid = r .oid
17001701AND r .relkind = ' r'
1701- AND (nr . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
1702+ AND (NOTpg_is_other_temp_schema( nr .oid ))
17021703AND (pg_has_role(r .relowner ,' USAGE' )
17031704-- SELECT privilege omitted, per SQL standard
17041705OR has_table_privilege(r .oid ,' INSERT' )
@@ -1731,7 +1732,7 @@ CREATE VIEW table_constraints AS
17311732AND a .attnum > 0
17321733AND NOTa .attisdropped
17331734AND r .relkind = ' r'
1734- AND (nr . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( r .oid ))
1735+ AND (NOTpg_is_other_temp_schema( nr .oid ))
17351736AND (pg_has_role(r .relowner ,' USAGE' )
17361737OR has_table_privilege(r .oid ,' SELECT' )
17371738OR 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 WHENnc .nspname LIKE ' pg!_temp!_% ' ESCAPE ' ! ' THEN' LOCAL TEMPORARY'
1810+ CASE WHENnc .oid = pg_my_temp_schema() THEN' LOCAL TEMPORARY'
18101811 WHENc .relkind = ' r' THEN' BASE TABLE'
18111812 WHENc .relkind = ' v' THEN' VIEW'
18121813 ELSEnull END
@@ -1823,15 +1824,15 @@ CREATE VIEW tables AS
18231824 THEN' YES' ELSE' NO' ENDAS character_data)AS is_insertable_into,
18241825 CAST(' NO' AS character_data)AS is_typed,
18251826 CAST(
1826- CASE WHENnc .nspname LIKE ' pg!_temp!_% ' ESCAPE ' ! ' THEN' PRESERVE'
1827+ CASE WHENnc .oid = pg_my_temp_schema() THEN' PRESERVE' -- FIXME
18271828 ELSEnull END
18281829AS character_data)AS commit_action
18291830
18301831FROM pg_namespace nc, pg_class c
18311832
18321833WHERE c .relnamespace = nc .oid
18331834AND c .relkind IN (' r' ,' v' )
1834- AND (nc . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1835+ AND (NOTpg_is_other_temp_schema( nc .oid ))
18351836AND (pg_has_role(c .relowner ,' USAGE' )
18361837OR has_table_privilege(c .oid ,' SELECT' )
18371838OR has_table_privilege(c .oid ,' INSERT' )
@@ -1952,7 +1953,7 @@ CREATE VIEW triggers AS
19521953AND c .oid = t .tgrelid
19531954AND t .tgtype &em .num <> 0
19541955AND NOTt .tgisconstraint
1955- AND (n . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
1956+ AND (NOTpg_is_other_temp_schema( n .oid ))
19561957AND (pg_has_role(c .relowner ,' USAGE' )
19571958-- SELECT privilege omitted, per SQL standard
19581959OR has_table_privilege(c .oid ,' INSERT' )
@@ -2150,7 +2151,7 @@ CREATE VIEW views AS
21502151
21512152WHERE c .relnamespace = nc .oid
21522153AND c .relkind = ' v'
2153- AND (nc . nspname NOTLIKE ' pg!_temp!_% ' ESCAPE ' ! ' OR pg_catalog . pg_table_is_visible ( c .oid ))
2154+ AND (NOTpg_is_other_temp_schema( nc .oid ))
21542155AND (pg_has_role(c .relowner ,' USAGE' )
21552156OR has_table_privilege(c .oid ,' SELECT' )
21562157OR has_table_privilege(c .oid ,' INSERT' )