table_privileges view under information_schema doesn't show privileges on materialized views
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t39248psql -h localhost -U postgresBuilt from patchset v4 (message #4), September 20, 2026 at 12:54 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t39248_4 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t39248_4 && git checkout t39248_4Patchset v4 (message #4) is on t39248_4
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]https://www.postgresql.org/docs/devel/static/infoschema-table-privileges.html, 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
Attachments:
0001-Allow-table_privileges-view-in-information_schema.sq.patchtext/x-patch; charset=US-ASCII; name=0001-Allow-table_privileges-view-in-information_schema.sq.patchDownload+1-2
Ashutosh Sharma <ashu.coek88@gmail.com> writes:
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.
The spec is quite clear that rows in table_privileges must correspond
to rows in information_schema.tables, but we don't show materialized
views there.
Perhaps there's a case for showing MVs in the "tables" view, and thence
also in table_privileges, but this patch by itself is flat wrong.
Anyway it seems to me we made that decision already; it's a bit late now
to be revisiting whether MVs should be treated as tables here.
regards, tom lane
On Fri, Aug 24, 2018 at 9:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Ashutosh Sharma <ashu.coek88@gmail.com> writes:
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.The spec is quite clear that rows in table_privileges must correspond
to rows in information_schema.tables, but we don't show materialized
views there.Perhaps there's a case for showing MVs in the "tables" view, and thence
also in table_privileges, but this patch by itself is flat wrong.
Okay. But I couldn't find any such case for showing MVs in "tables" or
"table_privileges" view. In fact, I could see some more views under
information_schema that doesn't consider MVs, For e.g.
column_privileges.
Anyway it seems to me we made that decision already; it's a bit late now
to be revisiting whether MVs should be treated as tables here.
Okay. However, I feel, if normal view can be treated as tables then
MVs could also be. Thanks,
--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com
On Fri, Aug 24, 2018 at 9:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Ashutosh Sharma <ashu.coek88@gmail.com> writes:
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.The spec is quite clear that rows in table_privileges must correspond
to rows in information_schema.tables, but we don't show materialized
views there.
Okay, In that case, I've changed the patch so that both tables and
tables_privileges shows the materialized view. PFA patch. Sorry, I
just missed that point earlier.
Show quoted text
Perhaps there's a case for showing MVs in the "tables" view, and thence
also in table_privileges, but this patch by itself is flat wrong.Anyway it seems to me we made that decision already; it's a bit late now
to be revisiting whether MVs should be treated as tables here.regards, tom lane