summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut2011-03-02 21:10:41 +0000
committerPeter Eisentraut2011-03-02 21:17:56 +0000
commit091bda0188250c9802cebca066b4ca9e049616e6 (patch)
tree524811457cbfc814ec973884dc2e4bf009399b27 /src
parent43bdf3583a9a5912e1800ab140b8ca495ae69d85 (diff)
Add collations to information_schema.usage_privileges
This is faked information like for domains.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/information_schema.sql21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql
index e81a3bb40df..1c47d81ba8c 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -2019,6 +2019,27 @@ GRANT SELECT ON triggers TO PUBLIC;
CREATE VIEW usage_privileges AS
+ /* collations */
+ -- Collations have no real privileges, so we represent all collations with implicit usage privilege here.
+ SELECT CAST(u.rolname AS sql_identifier) AS grantor,
+ CAST('PUBLIC' AS sql_identifier) AS grantee,
+ CAST(current_database() AS sql_identifier) AS object_catalog,
+ CAST(n.nspname AS sql_identifier) AS object_schema,
+ CAST(c.collname AS sql_identifier) AS object_name,
+ CAST('COLLATION' AS character_data) AS object_type,
+ CAST('USAGE' AS character_data) AS privilege_type,
+ CAST('NO' AS yes_or_no) AS is_grantable
+
+ FROM pg_authid u,
+ pg_namespace n,
+ pg_collation c
+
+ WHERE u.oid = c.collowner
+ AND c.collnamespace = n.oid
+ AND c.collencoding = (SELECT encoding FROM pg_catalog.pg_database WHERE datname = pg_catalog.current_database())
+
+ UNION ALL
+
/* domains */
-- Domains have no real privileges, so we represent all domains with implicit usage privilege here.
SELECT CAST(u.rolname AS sql_identifier) AS grantor,