user2588667
user2588667

Reputation: 510

Understanding the output of PSQL's \dp and \z

I'm having trouble selecting from a database in PSQL. This is the output of the table I'm interested in. Can someone decipher the access priveleges for me? I know that arwdRxt means append,read,write,etc... The syntax is confusing to me, what exactly do the slashes and equals mean in the access privileges column? Please let me know if my question isn't clear.

                    Access privileges
 schema |     name      | type |    access privileges    
--------+---------------+------+-------------------------
 public | table_name    | view | amazonuser=arwdRxt/amazonuser+
        |               |      | readonly=r/amazonuser

Upvotes: 8

Views: 8377

Answers (2)

jjanes
jjanes

Reputation: 44373

It is described in detail in the docs. The thing before the = is who has those permissions, the thing after the / is who granted those permissions.

Upvotes: 13

Ryan Biwer
Ryan Biwer

Reputation: 444

From the docs:

Privilege   Abbreviation    Applicable Object Types
SELECT      r (“read”)      LARGE OBJECT, SEQUENCE, TABLE (and table-like objects), table column
INSERT      a (“append”)    TABLE, table column
UPDATE      w (“write”)     LARGE OBJECT, SEQUENCE, TABLE, table column
DELETE      d               TABLE
TRUNCATE    D               TABLE
REFERENCES  x               TABLE, table column
TRIGGER     t               TABLE
CREATE      C               DATABASE, SCHEMA, TABLESPACE
CONNECT     c               DATABASE
TEMPORARY   T               DATABASE
EXECUTE     X               FUNCTION, PROCEDURE
USAGE       U               DOMAIN, FOREIGN DATA WRAPPER, FOREIGN SERVER, LANGUAGE, SCHEMA, SEQUENCE, TYPE

Upvotes: 3

Related Questions