From: Peter Eisentraut Date: Mon, 13 Jul 2009 20:25:57 +0000 (+0000) Subject: Update information schema to SQL:2008 X-Git-Tag: REL8_5_ALPHA1~147 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1ba29420b96c45bbfe0ce9014d4c0e99b798434;p=postgresql Update information schema to SQL:2008 - yes_or_no domain for "boolean" data - new columns for VIEWS view - slight section renumbering --- diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 78346d422d..0a48218122 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1,4 +1,4 @@ - + The Information Schema @@ -96,19 +96,24 @@ - - Every column in the information schema has one of these four types. - + + yes_or_no + + + A character string domain that contains + either YES or NO. This + is used to represent Boolean (true/false) data in the + information schema. (The information schema was invented + before the type boolean was added to the SQL + standard, so this convention is necessary to keep the + information schema backward compatible.) + + + + - - Boolean (true/false) data is represented in the information schema - by a column of type character_data that contains - either YES or NO. (The - information schema was invented before the type - boolean was added to the SQL standard, so this - convention is necessary to keep the information schema backward - compatible.) + Every column in the information schema has one of these five types. @@ -184,7 +189,7 @@ is_grantable - character_data + yes_or_no Always YES @@ -236,7 +241,7 @@ is_grantable - character_data + yes_or_no YES if the grantee has the admin option on the role, NO if not @@ -308,7 +313,7 @@ is_nullable - character_data + yes_or_no YES if the attribute is possibly nullable, NO if it is known not nullable. @@ -480,7 +485,7 @@ is_derived_reference_attribute - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -757,7 +762,7 @@ is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -907,7 +912,7 @@ is_nullable - character_data + yes_or_no YES if the column is possibly nullable, NO if it is known not nullable. A not-null @@ -1148,13 +1153,13 @@ is_self_referencing - character_data + yes_or_no Applies to a feature not available in PostgreSQL is_identity - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -1190,7 +1195,7 @@ identity_cycle - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -1208,7 +1213,7 @@ is_updatable - character_data + yes_or_no YES if the column is updatable, NO if not (Columns in base tables are always @@ -1544,13 +1549,13 @@ is_deferrable - character_data + yes_or_no YES if the constraint is deferrable, NO if not initially_deferred - character_data + yes_or_no YES if the constraint is deferrable and initially deferred, NO if not @@ -2545,13 +2550,13 @@ ORDER BY c.ordinal_position; is_result - character_data + yes_or_no Applies to a feature not available in PostgreSQL as_locator - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -2902,7 +2907,7 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -2992,7 +2997,7 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -3066,13 +3071,13 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not with_hierarchy - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -3149,7 +3154,7 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -3239,7 +3244,7 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -3568,7 +3573,7 @@ ORDER BY c.ordinal_position; is_deterministic - character_data + yes_or_no If the function is declared immutable (called deterministic in the SQL standard), then YES, else @@ -3589,7 +3594,7 @@ ORDER BY c.ordinal_position; is_null_call - character_data + yes_or_no If the function automatically returns null if any of its arguments are null, then YES, else @@ -3605,7 +3610,7 @@ ORDER BY c.ordinal_position; schema_level_routine - character_data + yes_or_no Always YES (The opposite would be a method of a user-defined type, which is a feature not available in @@ -3621,13 +3626,13 @@ ORDER BY c.ordinal_position; is_user_defined_cast - character_data + yes_or_no Applies to a feature not available in PostgreSQL is_implicitly_invocable - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -3662,7 +3667,7 @@ ORDER BY c.ordinal_position; as_locator - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -3680,13 +3685,13 @@ ORDER BY c.ordinal_position; new_savepoint_level - character_data + yes_or_no Applies to a feature not available in PostgreSQL is_udt_dependent - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -3698,7 +3703,7 @@ ORDER BY c.ordinal_position; result_cast_as_locator - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -4012,7 +4017,7 @@ ORDER BY c.ordinal_position; cycle_option - character_data + yes_or_no Not yet implemented @@ -4070,7 +4075,7 @@ ORDER BY c.ordinal_position; is_supported - character_data + yes_or_no YES if the feature is fully supported by the current version of PostgreSQL, NO if not @@ -4289,7 +4294,7 @@ ORDER BY c.ordinal_position; is_supported - character_data + yes_or_no YES if the package is fully supported by the current version of PostgreSQL, NO if not @@ -4351,7 +4356,7 @@ ORDER BY c.ordinal_position; is_supported - character_data + yes_or_no YES if the part is fully supported by the current version of PostgreSQL, @@ -4569,13 +4574,13 @@ ORDER BY c.ordinal_position; is_deferrable - character_data + yes_or_no YES if the constraint is deferrable, NO if not initially_deferred - character_data + yes_or_no YES if the constraint is deferrable and initially deferred, NO if not @@ -4649,13 +4654,13 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not with_hierarchy - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -4747,7 +4752,7 @@ ORDER BY c.ordinal_position; is_insertable_into - character_data + yes_or_no YES if the table is insertable into, NO if not (Base tables are always insertable @@ -4757,7 +4762,7 @@ ORDER BY c.ordinal_position; is_typed - character_data + yes_or_no Applies to a feature not available in PostgreSQL @@ -5025,7 +5030,7 @@ ORDER BY c.ordinal_position; is_grantable - character_data + yes_or_no YES if the privilege is grantable, NO if not @@ -5434,7 +5439,7 @@ ORDER BY c.ordinal_position; is_updatable - character_data + yes_or_no YES if the view is updatable (allows UPDATE and DELETE), @@ -5444,12 +5449,30 @@ ORDER BY c.ordinal_position; is_insertable_into - character_data + yes_or_no YES if the view is insertable into (allows INSERT), NO if not + + + is_trigger_updatable + yes_or_no + Applies to a feature not available in PostgreSQL + + + + is_trigger_deletable + yes_or_no + Applies to a feature not available in PostgreSQL + + + + is_trigger_insertable_into + yes_or_no + Applies to a feature not available in PostgreSQL + diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql index 09d2ccef21..cea4f79775 100644 --- a/src/backend/catalog/information_schema.sql +++ b/src/backend/catalog/information_schema.sql @@ -1,10 +1,10 @@ /* * SQL Information Schema - * as defined in ISO/IEC 9075-11:2003 + * as defined in ISO/IEC 9075-11:2008 * * Copyright (c) 2003-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.56 2009/07/07 19:28:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.57 2009/07/13 20:25:57 petere Exp $ */ /* @@ -221,19 +221,27 @@ GRANT SELECT ON information_schema_catalog_name TO PUBLIC; CREATE DOMAIN time_stamp AS timestamp(2) with time zone DEFAULT current_timestamp(2); +/* + * 5.7 + * YES_OR_NO domain + */ + +CREATE DOMAIN yes_or_no AS character varying(3) + CONSTRAINT yes_or_no_check CHECK (value IN ('YES', 'NO')); --- 5.7 ADMINISTRABLE_ROLE_AUTHORIZATIONS view appears later. + +-- 5.8 ADMINISTRABLE_ROLE_AUTHORIZATIONS view appears later. /* - * 5.8 + * 5.9 * APPLICABLE_ROLES view */ CREATE VIEW applicable_roles AS SELECT CAST(a.rolname AS sql_identifier) AS grantee, CAST(b.rolname AS sql_identifier) AS role_name, - CAST(CASE WHEN m.admin_option THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + CAST(CASE WHEN m.admin_option THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_auth_members m JOIN pg_authid a ON (m.member = a.oid) JOIN pg_authid b ON (m.roleid = b.oid) @@ -243,7 +251,7 @@ GRANT SELECT ON applicable_roles TO PUBLIC; /* - * 5.7 + * 5.8 * ADMINISTRABLE_ROLE_AUTHORIZATIONS view */ @@ -256,7 +264,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC; /* - * 5.9 + * 5.10 * ASSERTIONS view */ @@ -264,7 +272,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC; /* - * 5.10 + * 5.11 * ATTRIBUTES view */ @@ -276,7 +284,7 @@ CREATE VIEW attributes AS CAST(a.attnum AS cardinal_number) AS ordinal_position, CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS attribute_default, CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS character_data) + AS yes_or_no) AS is_nullable, CAST( @@ -337,7 +345,7 @@ CREATE VIEW attributes AS CAST(null AS cardinal_number) AS maximum_cardinality, CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS character_data) AS is_derived_reference_attribute + CAST('NO' AS yes_or_no) AS is_derived_reference_attribute FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum), pg_class c, pg_namespace nc, @@ -353,7 +361,7 @@ GRANT SELECT ON attributes TO PUBLIC; /* - * 5.11 + * 5.12 * CHARACTER_SETS view */ @@ -361,7 +369,7 @@ GRANT SELECT ON attributes TO PUBLIC; /* - * 5.12 + * 5.13 * CHECK_CONSTRAINT_ROUTINE_USAGE view */ @@ -386,7 +394,7 @@ GRANT SELECT ON check_constraint_routine_usage TO PUBLIC; /* - * 5.13 + * 5.14 * CHECK_CONSTRAINTS view */ @@ -424,14 +432,14 @@ GRANT SELECT ON check_constraints TO PUBLIC; /* - * 5.14 + * 5.15 * COLLATIONS view */ -- feature not supported /* - * 5.15 + * 5.16 * COLLATION_CHARACTER_SET_APPLICABILITY view */ @@ -439,7 +447,7 @@ GRANT SELECT ON check_constraints TO PUBLIC; /* - * 5.16 + * 5.17 * COLUMN_COLUMN_USAGE view */ @@ -447,7 +455,7 @@ GRANT SELECT ON check_constraints TO PUBLIC; /* - * 5.17 + * 5.18 * COLUMN_DOMAIN_USAGE view */ @@ -477,7 +485,7 @@ GRANT SELECT ON column_domain_usage TO PUBLIC; /* - * 5.18 + * 5.19 * COLUMN_PRIVILEGES */ @@ -497,7 +505,7 @@ CREATE VIEW column_privileges AS makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) OR aclcontains(a.attacl, makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_attribute a, pg_class c, @@ -530,7 +538,7 @@ GRANT SELECT ON column_privileges TO PUBLIC; /* - * 5.19 + * 5.20 * COLUMN_UDT_USAGE view */ @@ -558,7 +566,7 @@ GRANT SELECT ON column_udt_usage TO PUBLIC; /* - * 5.20 + * 5.21 * COLUMNS view */ @@ -570,7 +578,7 @@ CREATE VIEW columns AS CAST(a.attnum AS cardinal_number) AS ordinal_position, CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS column_default, CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS character_data) + AS yes_or_no) AS is_nullable, CAST( @@ -644,15 +652,15 @@ CREATE VIEW columns AS CAST(null AS cardinal_number) AS maximum_cardinality, CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS character_data) AS is_self_referencing, + CAST('NO' AS yes_or_no) AS is_self_referencing, - CAST('NO' AS character_data) AS is_identity, + CAST('NO' AS yes_or_no) AS is_identity, CAST(null AS character_data) AS identity_generation, CAST(null AS character_data) AS identity_start, CAST(null AS character_data) AS identity_increment, CAST(null AS character_data) AS identity_maximum, CAST(null AS character_data) AS identity_minimum, - CAST(null AS character_data) AS identity_cycle, + CAST(null AS yes_or_no) AS identity_cycle, CAST('NEVER' AS character_data) AS is_generated, CAST(null AS character_data) AS generation_expression, @@ -661,7 +669,7 @@ CREATE VIEW columns AS OR (c.relkind = 'v' AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_updatable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum), pg_class c, pg_namespace nc, @@ -684,7 +692,7 @@ GRANT SELECT ON columns TO PUBLIC; /* - * 5.21 + * 5.22 * CONSTRAINT_COLUMN_USAGE view */ @@ -736,7 +744,7 @@ GRANT SELECT ON constraint_column_usage TO PUBLIC; /* - * 5.22 + * 5.23 * CONSTRAINT_TABLE_USAGE view */ @@ -760,11 +768,11 @@ CREATE VIEW constraint_table_usage AS GRANT SELECT ON constraint_table_usage TO PUBLIC; --- 5.23 DATA_TYPE_PRIVILEGES view appears later. +-- 5.24 DATA_TYPE_PRIVILEGES view appears later. /* - * 5.24 + * 5.25 * DIRECT_SUPERTABLES view */ @@ -772,7 +780,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC; /* - * 5.25 + * 5.26 * DIRECT_SUPERTYPES view */ @@ -780,7 +788,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC; /* - * 5.26 + * 5.27 * DOMAIN_CONSTRAINTS view */ @@ -792,9 +800,9 @@ CREATE VIEW domain_constraints AS CAST(n.nspname AS sql_identifier) AS domain_schema, CAST(t.typname AS sql_identifier) AS domain_name, CAST(CASE WHEN condeferrable THEN 'YES' ELSE 'NO' END - AS character_data) AS is_deferrable, + AS yes_or_no) AS is_deferrable, CAST(CASE WHEN condeferred THEN 'YES' ELSE 'NO' END - AS character_data) AS initially_deferred + AS yes_or_no) AS initially_deferred FROM pg_namespace rs, pg_namespace n, pg_constraint con, pg_type t WHERE rs.oid = con.connamespace AND n.oid = t.typnamespace @@ -829,7 +837,7 @@ GRANT SELECT ON domain_udt_usage TO PUBLIC; /* - * 5.27 + * 5.28 * DOMAINS view */ @@ -910,11 +918,11 @@ CREATE VIEW domains AS GRANT SELECT ON domains TO PUBLIC; --- 5.28 ELEMENT_TYPES view appears later. +-- 5.29 ELEMENT_TYPES view appears later. /* - * 5.29 + * 5.30 * ENABLED_ROLES view */ @@ -927,7 +935,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC; /* - * 5.30 + * 5.31 * FIELDS view */ @@ -935,7 +943,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC; /* - * 5.31 + * 5.32 * KEY_COLUMN_USAGE view */ @@ -978,7 +986,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; /* - * 5.32 + * 5.33 * METHOD_SPECIFICATION_PARAMETERS view */ @@ -986,7 +994,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; /* - * 5.33 + * 5.34 * METHOD_SPECIFICATIONS view */ @@ -994,7 +1002,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; /* - * 5.34 + * 5.35 * PARAMETERS view */ @@ -1011,8 +1019,8 @@ CREATE VIEW parameters AS WHEN proargmodes[(ss.x).n] = 'v' THEN 'IN' WHEN proargmodes[(ss.x).n] = 't' THEN 'OUT' END AS character_data) AS parameter_mode, - CAST('NO' AS character_data) AS is_result, - CAST('NO' AS character_data) AS as_locator, + CAST('NO' AS yes_or_no) AS is_result, + CAST('NO' AS yes_or_no) AS as_locator, CAST(NULLIF(proargnames[(ss.x).n], '') AS sql_identifier) AS parameter_name, CAST( CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' @@ -1056,7 +1064,7 @@ GRANT SELECT ON parameters TO PUBLIC; /* - * 5.35 + * 5.36 * REFERENCED_TYPES view */ @@ -1064,7 +1072,7 @@ GRANT SELECT ON parameters TO PUBLIC; /* - * 5.36 + * 5.37 * REFERENTIAL_CONSTRAINTS view */ @@ -1122,7 +1130,7 @@ GRANT SELECT ON referential_constraints TO PUBLIC; /* - * 5.37 + * 5.38 * ROLE_COLUMN_GRANTS view */ @@ -1142,7 +1150,7 @@ CREATE VIEW role_column_grants AS makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) OR aclcontains(a.attacl, makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_attribute a, pg_class c, @@ -1170,7 +1178,7 @@ GRANT SELECT ON role_column_grants TO PUBLIC; /* - * 5.38 + * 5.39 * ROLE_ROUTINE_GRANTS view */ @@ -1190,7 +1198,7 @@ CREATE VIEW role_routine_grants AS pg_has_role(g_grantee.oid, p.proowner, 'USAGE') OR aclcontains(p.proacl, makeaclitem(g_grantee.oid, u_grantor.oid, 'EXECUTE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_proc p, pg_namespace n, @@ -1207,7 +1215,7 @@ GRANT SELECT ON role_routine_grants TO PUBLIC; /* - * 5.39 + * 5.40 * ROLE_TABLE_GRANTS view */ @@ -1224,8 +1232,8 @@ CREATE VIEW role_table_grants AS pg_has_role(g_grantee.oid, c.relowner, 'USAGE') OR aclcontains(c.relacl, makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable, - CAST('NO' AS character_data) AS with_hierarchy + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, + CAST('NO' AS yes_or_no) AS with_hierarchy FROM pg_class c, pg_namespace nc, @@ -1250,7 +1258,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC; /* - * 5.40 + * 5.41 * ROLE_TABLE_METHOD_GRANTS view */ @@ -1258,7 +1266,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC; /* - * 5.41 + * 5.42 * ROLE_USAGE_GRANTS view */ @@ -1278,7 +1286,7 @@ CREATE VIEW role_usage_grants AS pg_has_role(g_grantee.oid, fdw.fdwowner, 'USAGE') OR aclcontains(fdw.fdwacl, makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_foreign_data_wrapper fdw, pg_authid u_grantor, @@ -1305,7 +1313,7 @@ CREATE VIEW role_usage_grants AS pg_has_role(g_grantee.oid, srv.srvowner, 'USAGE') OR aclcontains(srv.srvacl, makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_foreign_server srv, pg_authid u_grantor, @@ -1320,7 +1328,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; /* - * 5.42 + * 5.43 * ROLE_UDT_GRANTS view */ @@ -1328,7 +1336,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; /* - * 5.43 + * 5.44 * ROUTINE_COLUMN_USAGE view */ @@ -1336,7 +1344,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; /* - * 5.44 + * 5.45 * ROUTINE_PRIVILEGES view */ @@ -1356,7 +1364,7 @@ CREATE VIEW routine_privileges AS pg_has_role(grantee.oid, p.proowner, 'USAGE') OR aclcontains(p.proacl, makeaclitem(grantee.oid, u_grantor.oid, 'EXECUTE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_proc p, pg_namespace n, @@ -1378,7 +1386,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; /* - * 5.45 + * 5.46 * ROUTINE_ROUTINE_USAGE view */ @@ -1386,7 +1394,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; /* - * 5.46 + * 5.47 * ROUTINE_SEQUENCE_USAGE view */ @@ -1394,7 +1402,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; /* - * 5.47 + * 5.48 * ROUTINE_TABLE_USAGE view */ @@ -1402,7 +1410,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; /* - * 5.48 + * 5.49 * ROUTINES view */ @@ -1460,26 +1468,26 @@ CREATE VIEW routines AS CAST(upper(l.lanname) AS character_data) AS external_language, CAST('GENERAL' AS character_data) AS parameter_style, - CAST(CASE WHEN p.provolatile = 'i' THEN 'YES' ELSE 'NO' END AS character_data) AS is_deterministic, + CAST(CASE WHEN p.provolatile = 'i' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_deterministic, CAST('MODIFIES' AS character_data) AS sql_data_access, - CAST(CASE WHEN p.proisstrict THEN 'YES' ELSE 'NO' END AS character_data) AS is_null_call, + CAST(CASE WHEN p.proisstrict THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_null_call, CAST(null AS character_data) AS sql_path, - CAST('YES' AS character_data) AS schema_level_routine, + CAST('YES' AS yes_or_no) AS schema_level_routine, CAST(0 AS cardinal_number) AS max_dynamic_result_sets, - CAST(null AS character_data) AS is_user_defined_cast, - CAST(null AS character_data) AS is_implicitly_invocable, + CAST(null AS yes_or_no) AS is_user_defined_cast, + CAST(null AS yes_or_no) AS is_implicitly_invocable, CAST(CASE WHEN p.prosecdef THEN 'DEFINER' ELSE 'INVOKER' END AS character_data) AS security_type, CAST(null AS sql_identifier) AS to_sql_specific_catalog, CAST(null AS sql_identifier) AS to_sql_specific_schema, CAST(null AS sql_identifier) AS to_sql_specific_name, - CAST('NO' AS character_data) AS as_locator, + CAST('NO' AS yes_or_no) AS as_locator, CAST(null AS time_stamp) AS created, CAST(null AS time_stamp) AS last_altered, - CAST(null AS character_data) AS new_savepoint_level, - CAST('YES' AS character_data) AS is_udt_dependent, -- FIXME? + CAST(null AS yes_or_no) AS new_savepoint_level, + CAST('YES' AS yes_or_no) AS is_udt_dependent, -- FIXME? CAST(null AS character_data) AS result_cast_from_data_type, - CAST(null AS character_data) AS result_cast_as_locator, + CAST(null AS yes_or_no) AS result_cast_as_locator, CAST(null AS cardinal_number) AS result_cast_char_max_length, CAST(null AS cardinal_number) AS result_cast_char_octet_length, CAST(null AS sql_identifier) AS result_cast_char_set_catalog, @@ -1515,7 +1523,7 @@ GRANT SELECT ON routines TO PUBLIC; /* - * 5.49 + * 5.50 * SCHEMATA view */ @@ -1534,7 +1542,7 @@ GRANT SELECT ON schemata TO PUBLIC; /* - * 5.50 + * 5.51 * SEQUENCES view */ @@ -1549,7 +1557,7 @@ CREATE VIEW sequences AS CAST(null AS cardinal_number) AS maximum_value, -- FIXME CAST(null AS cardinal_number) AS minimum_value, -- FIXME CAST(null AS cardinal_number) AS increment, -- FIXME - CAST(null AS character_data) AS cycle_option -- FIXME + CAST(null AS yes_or_no) AS cycle_option -- FIXME FROM pg_namespace nc, pg_class c WHERE c.relnamespace = nc.oid AND c.relkind = 'S' @@ -1561,7 +1569,7 @@ GRANT SELECT ON sequences TO PUBLIC; /* - * 5.51 + * 5.52 * SQL_FEATURES table */ @@ -1570,7 +1578,7 @@ CREATE TABLE sql_features ( feature_name character_data, sub_feature_id character_data, sub_feature_name character_data, - is_supported character_data, + is_supported yes_or_no, is_verified_by character_data, comments character_data ) WITHOUT OIDS; @@ -1581,12 +1589,12 @@ GRANT SELECT ON sql_features TO PUBLIC; /* - * 5.52 + * 5.53 * SQL_IMPLEMENTATION_INFO table */ --- Note: Implementation information items are defined in ISO/IEC 9075-3:2003, --- clause 7.1. +-- Note: Implementation information items are defined in ISO/IEC 9075-3:2008, +-- clause 9.1. CREATE TABLE sql_implementation_info ( implementation_info_id character_data, @@ -1613,8 +1621,8 @@ GRANT SELECT ON sql_implementation_info TO PUBLIC; /* - * 5.53 * SQL_LANGUAGES table + * apparently removed in SQL:2008 */ CREATE TABLE sql_languages ( @@ -1643,7 +1651,7 @@ GRANT SELECT ON sql_languages TO PUBLIC; CREATE TABLE sql_packages ( feature_id character_data, feature_name character_data, - is_supported character_data, + is_supported yes_or_no, is_verified_by character_data, comments character_data ) WITHOUT OIDS; @@ -1670,7 +1678,7 @@ GRANT SELECT ON sql_packages TO PUBLIC; CREATE TABLE sql_parts ( feature_id character_data, feature_name character_data, - is_supported character_data, + is_supported yes_or_no, is_verified_by character_data, comments character_data ) WITHOUT OIDS; @@ -1691,7 +1699,7 @@ INSERT INTO sql_parts VALUES ('14', 'XML-Related Specifications (SQL/XML)', 'YES * SQL_SIZING table */ --- Note: Sizing items are defined in ISO/IEC 9075-3:2003, clause 7.2. +-- Note: Sizing items are defined in ISO/IEC 9075-3:2008, clause 9.2. CREATE TABLE sql_sizing ( sizing_id cardinal_number, @@ -1770,9 +1778,9 @@ CREATE VIEW table_constraints AS WHEN 'p' THEN 'PRIMARY KEY' WHEN 'u' THEN 'UNIQUE' END AS character_data) AS constraint_type, - CAST(CASE WHEN c.condeferrable THEN 'YES' ELSE 'NO' END AS character_data) + CAST(CASE WHEN c.condeferrable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_deferrable, - CAST(CASE WHEN c.condeferred THEN 'YES' ELSE 'NO' END AS character_data) + CAST(CASE WHEN c.condeferred THEN 'YES' ELSE 'NO' END AS yes_or_no) AS initially_deferred FROM pg_namespace nc, @@ -1800,8 +1808,8 @@ CREATE VIEW table_constraints AS CAST(nr.nspname AS sql_identifier) AS table_schema, CAST(r.relname AS sql_identifier) AS table_name, CAST('CHECK' AS character_data) AS constraint_type, - CAST('NO' AS character_data) AS is_deferrable, - CAST('NO' AS character_data) AS initially_deferred + CAST('NO' AS yes_or_no) AS is_deferrable, + CAST('NO' AS yes_or_no) AS initially_deferred FROM pg_namespace nr, pg_class r, @@ -1848,8 +1856,8 @@ CREATE VIEW table_privileges AS pg_has_role(grantee.oid, c.relowner, 'USAGE') OR aclcontains(c.relacl, makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable, - CAST('NO' AS character_data) AS with_hierarchy + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, + CAST('NO' AS yes_or_no) AS with_hierarchy FROM pg_class c, pg_namespace nc, @@ -1905,9 +1913,9 @@ CREATE VIEW tables AS CAST(CASE WHEN c.relkind = 'r' OR (c.relkind = 'v' AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_insertable_into, + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into, - CAST('NO' AS character_data) AS is_typed, + CAST('NO' AS yes_or_no) AS is_typed, CAST( CASE WHEN nc.oid = pg_my_temp_schema() THEN 'PRESERVE' -- FIXME ELSE null END @@ -2067,7 +2075,7 @@ CREATE VIEW usage_privileges AS CAST(t.typname AS sql_identifier) AS object_name, CAST('DOMAIN' AS character_data) AS object_type, CAST('USAGE' AS character_data) AS privilege_type, - CAST('NO' AS character_data) AS is_grantable + CAST('NO' AS yes_or_no) AS is_grantable FROM pg_authid u, pg_namespace n, @@ -2093,7 +2101,7 @@ CREATE VIEW usage_privileges AS pg_has_role(grantee.oid, fdw.fdwowner, 'USAGE') OR aclcontains(fdw.fdwacl, makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_foreign_data_wrapper fdw, pg_authid u_grantor, @@ -2125,7 +2133,7 @@ CREATE VIEW usage_privileges AS pg_has_role(grantee.oid, srv.srvowner, 'USAGE') OR aclcontains(srv.srvacl, makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true)) - THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable + THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable FROM pg_foreign_server srv, pg_authid u_grantor, @@ -2281,12 +2289,16 @@ CREATE VIEW views AS CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead) THEN 'YES' ELSE 'NO' END - AS character_data) AS is_updatable, + AS yes_or_no) AS is_updatable, CAST( CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead) THEN 'YES' ELSE 'NO' END - AS character_data) AS is_insertable_into + AS yes_or_no) AS is_insertable_into, + + CAST('NO' AS yes_or_no) AS is_trigger_updatable, + CAST('NO' AS yes_or_no) AS is_trigger_deletable, + CAST('NO' AS yes_or_no) AS is_trigger_insertable_into FROM pg_namespace nc, pg_class c @@ -2303,7 +2315,7 @@ GRANT SELECT ON views TO PUBLIC; -- The following views have dependencies that force them to appear out of order. /* - * 5.23 + * 5.24 * DATA_TYPE_PRIVILEGES view */ @@ -2331,7 +2343,7 @@ GRANT SELECT ON data_type_privileges TO PUBLIC; /* - * 5.28 + * 5.29 * ELEMENT_TYPES view */