diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 40c0066d8ed..ab9ce2aa4a8 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -3509,6 +3509,81 @@ ORDER BY c.ordinal_position; + + <literal>role_udt_grants</literal> + + + The view role_udt_grants is intended to identify + USAGE privileges granted on user-defined types + where the grantor or grantee is a currently enabled role. Further + information can be found under + udt_privileges. The only effective difference + between this view and udt_privileges is that + this view omits objects that have been made accessible to the + current user by way of a grant to PUBLIC. Since + data types do not have real privileges in PostgreSQL, but only an + implicit grant to PUBLIC, this view is empty. + + + + <literal>role_udt_grants</literal> Columns + + + + + Name + Data Type + Description + + + + + + grantor + sql_identifier + The name of the role that granted the privilege + + + + grantee + sql_identifier + The name of the role that the privilege was granted to + + + + udt_catalog + sql_identifier + Name of the database containing the type (always the current database) + + + + udt_schema + sql_identifier + Name of the schema containing the type + + + + udt_name + sql_identifier + Name of the type + + + + privilege_type + character_data + Always TYPE USAGE + + + + is_grantable + yes_or_no + YES if the privilege is grantable, NO if not + + + +
+
+ <literal>role_usage_grants</literal> @@ -5499,6 +5574,80 @@ ORDER BY c.ordinal_position; + + <literal>udt_privileges</literal> + + + The view udt_privileges is intended to identify + USAGE privileges granted on user-defined types + to a currently enabled role or by a currently enabled role. Since + data types do not have real privileges + in PostgreSQL, this view shows implicit + non-grantable USAGE privileges granted by the + owner to PUBLIC for all types, including + built-in ones (except domains, + see for that). + + + + <literal>udt_privileges</literal> Columns + + + + + Name + Data Type + Description + + + + + + grantor + sql_identifier + Name of the role that granted the privilege + + + + grantee + sql_identifier + Name of the role that the privilege was granted to + + + + udt_catalog + sql_identifier + Name of the database containing the type (always the current database) + + + + udt_schema + sql_identifier + Name of the schema containing the type + + + + udt_name + sql_identifier + Name of the type + + + + privilege_type + character_data + Always TYPE USAGE + + + + is_grantable + yes_or_no + YES if the privilege is grantable, NO if not + + + +
+
+ <literal>usage_privileges</literal> @@ -5585,6 +5734,224 @@ ORDER BY c.ordinal_position; + + <literal>user_defined_types</literal> + + + The view user_defined_types currently contains + all composite types defined in the current database. + + + + SQL knows about two kinds of user-defined types: structured types + (also known as composite types + in PostgreSQL) and distinct types (not + implemented in PostgreSQL). To be + future-proof, use the + column user_defined_type_category to + differentiate between these. Other user-defined types such as base + types and enums, which are PostgreSQL + extensions, are not shown here. For domains, + see instead. + + + + <literal>user_defined_types</literal> Columns + + + + + Name + Data Type + Description + + + + + + user_defined_type_catalog + sql_identifier + Name of the database that contains the type (always the current database) + + + + user_defined_type_schema + sql_identifier + Name of the schema that contains the type + + + + user_defined_type_name + sql_identifier + Name of the type + + + + user_defined_type_category + character_data + + Currently always STRUCTURED + + + + + is_instantiable + yes_or_no + Applies to a feature not available in PostgreSQL + + + + is_final + yes_or_no + Applies to a feature not available in PostgreSQL + + + + ordering_form + character_data + Applies to a feature not available in PostgreSQL + + + + ordering_category + character_data + Applies to a feature not available in PostgreSQL + + + + ordering_routine_catalog + sql_identifier + Applies to a feature not available in PostgreSQL + + + + ordering_routine_schema + sql_identifier + Applies to a feature not available in PostgreSQL + + + + ordering_routine_name + sql_identifier + Applies to a feature not available in PostgreSQL + + + + reference_type + character_data + Applies to a feature not available in PostgreSQL + + + + data_type + character_data + + Always USER-DEFINED TYPE (for joining + against object_type columns in other + views) + + + + + character_maximum_length + cardinal_number + Applies to a feature not available in PostgreSQL + + + + character_octet_length + cardinal_number + Applies to a feature not available in PostgreSQL + + + + character_set_catalog + sql_identifier + Applies to a feature not available in PostgreSQL + + + + character_set_schema + sql_identifier + Applies to a feature not available in PostgreSQL + + + + character_set_name + sql_identifier + Applies to a feature not available in PostgreSQL + + + + collation_catalog + sql_identifier + Applies to a feature not available in PostgreSQL + + + + collation_schema + sql_identifier + Applies to a feature not available in PostgreSQL + + + + collation_name + sql_identifier + Applies to a feature not available in PostgreSQL + + + + numeric_precision + cardinal_number + Applies to a feature not available in PostgreSQL + + + + numeric_precision_radix + cardinal_number + Applies to a feature not available in PostgreSQL + + + + numeric_scale + cardinal_number + Applies to a feature not available in PostgreSQL + + + + datetime_precision + cardinal_number + Applies to a feature not available in PostgreSQL + + + + interval_type + character_data + Applies to a feature not available in PostgreSQL + + + + interval_precision + character_data + Applies to a feature not available in PostgreSQL + + + + source_dtd_identifier + sql_identifier + Applies to a feature not available in PostgreSQL + + + + ref_dtd_identifier + sql_identifier + Applies to a feature not available in PostgreSQL + + + +
+
+ <literal>user_mapping_options</literal> diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql index 81407a3a5ee..9334c7654d1 100644 --- a/src/backend/catalog/information_schema.sql +++ b/src/backend/catalog/information_schema.sql @@ -1215,12 +1215,7 @@ GRANT SELECT ON role_column_grants TO PUBLIC; -- 5.42 ROLE_USAGE_GRANTS view is based on 5.71 USAGE_PRIVILEGES and is defined there instead. -/* - * 5.43 - * ROLE_UDT_GRANTS view - */ - --- feature not supported +-- 5.43 ROLE_UDT_GRANTS view is based on 5.70 UDT_PRIVILEGES and is defined there instead. /* @@ -2009,7 +2004,43 @@ GRANT SELECT ON triggers TO PUBLIC; * UDT_PRIVILEGES view */ --- feature not supported +CREATE VIEW udt_privileges AS + SELECT CAST(null AS sql_identifier) AS grantor, + CAST('PUBLIC' AS sql_identifier) AS grantee, + CAST(current_database() AS sql_identifier) AS udt_catalog, + CAST(n.nspname AS sql_identifier) AS udt_schema, + CAST(t.typname AS sql_identifier) AS udt_name, + CAST('TYPE USAGE' AS character_data) AS privilege_type, -- sic + CAST('NO' AS yes_or_no) AS is_grantable + + FROM pg_authid u, pg_namespace n, pg_type t + + WHERE u.oid = t.typowner + AND n.oid = t.typnamespace + AND t.typtype <> 'd' + AND NOT (t.typelem <> 0 AND t.typlen = -1); + +GRANT SELECT ON udt_privileges TO PUBLIC; + + +/* + * 5.43 + * ROLE_UDT_GRANTS view + */ + +CREATE VIEW role_udt_grants AS + SELECT grantor, + grantee, + udt_catalog, + udt_schema, + udt_name, + privilege_type, + is_grantable + FROM udt_privileges + WHERE grantor IN (SELECT role_name FROM enabled_roles) + OR grantee IN (SELECT role_name FROM enabled_roles); + +GRANT SELECT ON role_udt_grants TO PUBLIC; /* @@ -2156,7 +2187,43 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; * USER_DEFINED_TYPES view */ --- feature not supported +CREATE VIEW user_defined_types AS + SELECT CAST(current_database() AS sql_identifier) AS user_defined_type_catalog, + CAST(n.nspname AS sql_identifier) AS user_defined_type_schema, + CAST(c.relname AS sql_identifier) AS user_defined_type_name, + CAST('STRUCTURED' AS character_data) AS user_defined_type_category, + CAST('YES' AS yes_or_no) AS is_instantiable, + CAST(null AS yes_or_no) AS is_final, + CAST(null AS character_data) AS ordering_form, + CAST(null AS character_data) AS ordering_category, + CAST(null AS sql_identifier) AS ordering_routine_catalog, + CAST(null AS sql_identifier) AS ordering_routine_schema, + CAST(null AS sql_identifier) AS ordering_routine_name, + CAST(null AS character_data) AS reference_type, + CAST('USER-DEFINED TYPE' AS character_data) AS data_type, + CAST(null AS cardinal_number) AS character_maximum_length, + CAST(null AS cardinal_number) AS character_octet_length, + CAST(null AS sql_identifier) AS character_set_catalog, + CAST(null AS sql_identifier) AS character_set_schema, + CAST(null AS sql_identifier) AS character_set_name, + CAST(null AS sql_identifier) AS collation_catalog, + CAST(null AS sql_identifier) AS collation_schema, + CAST(null AS sql_identifier) AS collation_name, + CAST(null AS cardinal_number) AS numeric_precision, + CAST(null AS cardinal_number) AS numeric_precision_radix, + CAST(null AS cardinal_number) AS numeric_scale, + CAST(null AS cardinal_number) AS datetime_precision, + CAST(null AS character_data) AS interval_type, + CAST(null AS character_data) AS interval_precision, + CAST(null AS sql_identifier) AS source_dtd_identifier, + CAST(null AS sql_identifier) AS ref_dtd_identifier + + FROM pg_namespace n, pg_class c + + WHERE n.oid = c.relnamespace + AND c.relkind = 'c'; + +GRANT SELECT ON user_defined_types TO PUBLIC; /*