Sam VanFossen
Sam VanFossen

Reputation: 1

Granting permission in Postgresql to user never gives permission

I'm trying to give access to a database to a new user in PostgreSQL 10.12. For context, I'm using Ubuntu 18.04. I created the database with this code:

CREATE DATABASE jiradb WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;

The user was given access with this code:

GRANT ALL PRIVILEGES ON DATABASE

Whenever I type "\z", all I see is this:

Access privileges
 Schema | Name | Type | Access privileges | Column privileges | Policies
--------+------+------+-------------------+-------------------+----------
(0 rows)}

What I want to see is that this user "jiradbuser" has all access to the database "jiradb". I've checked PostgreSQL's web site, and nothing there has been helpful. How can I give this user the proper access?

Upvotes: 0

Views: 247

Answers (1)

Anthony Sotolongo
Anthony Sotolongo

Reputation: 1648

The command

GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] }
ON DATABASE database_name [, ...]
TO role_specification [, ...] [ WITH GRANT OPTION ]

give access over the database with { CREATE | CONNECT | TEMPORARY | TEMP }

you will see the privileges with meta-command

\l

the meta-command

 \z

Is to see privileges for tables view, sequences, in other words, are different types of objects (database and tables view, sequences)

you will see the tables view, sequences privileges given with the command

GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
[, ...] | ALL [ PRIVILEGES ] }
ON { [ TABLE ] table_name [, ...]
     | ALL TABLES IN SCHEMA schema_name [, ...] }
TO role_specification [, ...] [ WITH GRANT OPTION ]

here you can use

\z 

Upvotes: 1

Related Questions