[PATCH] pg_ownerships system view

Started by Joel Jacobsonabout 5 years ago2 messageshackers
Jump to latest
#1Joel Jacobson
joel@compiler.org

Hi,

Attached is a suggestion of adding a convenience view,
allowing quickly looking up all objects owned by a given user.

Example:

SELECT * FROM ownerships WHERE rolname = 'joel' LIMIT 5;
regclass | obj_desc | rolname
------------------+-----------------------------------+---------
pg_class | table t | joel
pg_class | table foobar.foobar_policed_table | joel
pg_class | view ownerships | joel
pg_collation | collation foobar.foobar | joel
pg_event_trigger | event trigger foobar | joel
(5 rows)

This is similar to the suggested pg_permissions system view in other thread.

/Joel

Attachments:

0002-pg_ownerships.patchapplication/octet-stream; name=0002-pg_ownerships.patchDownload+173-2
#2Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Joel Jacobson (#1)
Re: [PATCH] pg_ownerships system view

On 3/7/21 1:08 AM, Joel Jacobson wrote:

Attached is a suggestion of adding a convenience view,
allowing quickly looking up all objects owned by a given user.

This definitely seems like a useful feature. I know I am guilty of
creating tables as the wrong role more than one time.

Andreas