April 2026
Beginner
493 pages
23h 2m
English
In this section, we’ll go over some useful queries to detect the most current state of privileges. You can use them as is or modify them according to your own requirements. We’ve covered some of these queries previously, but we’ll consolidate them here as well to keep the topic self-contained.
The statements refer to tables or views that are specific to PostgreSQL. Other database products offer different tables or mechanisms to report privileges.
If you need a simple list of users, you can refer to the pg_user table as in Listing 8.38.
SELECT usenameFROM pg_userORDER BY usenameLIMIT 4;
Listing 8.38 Query for Database Users
The results of the query can be seen in Table 8.10. Note that this ...
Read now
Unlock full access