Using column privilege with geometry_columns and other metadata views

Arthur Bazin ab-postgis-devel at bazmap.com
Wed Jul 15 12:09:55 PDT 2026


Hello,

I've seen that geometry_columns, geography_columns, raster_columns and
raster_overviews only display layers for which the role can at least
SELECT on the table.
But sometimes privileges are specific and only a subset of columns are
defined as ''SELECTable''.
These views doesn't reference the geom column if its privileges are
column defined like this :
GRANT SELECT(geom) ON schema.my_table TO my_user;

We need to use has_column_privilege() instead of has_table_privilege()
in the where clause of these views.
The first function succeeds either if the privilege is held for the
whole table, or if there is a column-level grant of the privilege for
the column.

I've made a fork of the PostGIS project to test this update and it
works great.
I've created a branch and commited the modifications to make a PR
: https://gitea.osgeo.org/arthurbazin/postgis/commit/d75464c991d25dc1f602a9e641ce40a8bfaaaea0

Before submitting it, I would like to have your opinion on this
improvement.

Note that I didn't create any ticket on track to avoid the auto
resolution by the new AI bot (if my informations are good) and start
my first PR on this project (easy one but we need to start somewhere)

Best regards !

/// ARTHUR BAZIN ___
⟁ France

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20260715/71cb505e/attachment.htm>


More information about the postgis-devel mailing list