Hi All,

Currently, table_privileges view in information_schema.sql doesn't
show privileges on materialized views for currently enabled roles. As
per the documentation-[1], it should be showing the all privileges
granted on tables and views (the documentation doesn't says it has to
be normal view). Shouldn't we allow it to show privileges on
materialized views as well.

Attached is the patch with necessary changes in table_privileges view
to show the privileges on materialized views. Please let me know your
thoughts on this. Thank you.

[1] - 
https://www.postgresql.org/docs/devel/static/infoschema-table-privileges.html

-- 
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com
From 1c456ad6ee6377743b764bd16c87c435d6f2d63f Mon Sep 17 00:00:00 2001
From: ashu <ashutosh.sha...@enterprisedb.com>
Date: Thu, 23 Aug 2018 14:45:51 +0530
Subject: [PATCH] Allow table_privileges view in information_schema.sql to show
 privileges on materialized views.

Currently, table_privileges view shows the privileges only on normal
views and tables. This patch allows it to do the same for materialized
views as well.
---
 src/backend/catalog/information_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql
index b4315fa..1591e97 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -1876,7 +1876,7 @@ CREATE VIEW table_privileges AS
          ) AS grantee (oid, rolname)
 
     WHERE c.relnamespace = nc.oid
-          AND c.relkind IN ('r', 'v', 'f', 'p')
+          AND c.relkind IN ('r', 'v', 'f', 'p', 'm')
           AND c.grantee = grantee.oid
           AND c.grantor = u_grantor.oid
           AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER')
-- 
1.8.3.1

Reply via email to