Re: how to list privileges on the database object itself via SQL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



richard coleman <rcoleman.ascentgl@xxxxxxxxx> writes:
> Thanks for that.  It still seems rather weird that there isn't a more
> straightforward way to get access to that information.

You could just read the system catalog documentation:

https://www.postgresql.org/docs/current/catalogs.html

psql's queries are mostly useful as a shortcut to finding out
where to look.

> Also the SQL generated by psql -E doesn't seem to work on earlier versions
> of PostgreSQL:

Yeah, you'd need to try it against a server of the vintage you
care about.  (Also read the documentation of the correct version.)

> Are you saying that the only place this information is stored
> is in an array in the datacl column of the pg_catalog.pg_database table?

Precisely.

> If that's the case then I am going to be forced to either write code to
> parse out that array, or write a looping union of multiple
> "has_database_privilege()" calls.

You were already pointed at aclexplode(), which might help.

select datname, a.* from pg_database, aclexplode(datacl) a;

			regards, tom lane





[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux