Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres 9.1 GRANT does not work

I try to grant privileges like that:

zielony=# GRANT ALL PRIVILEGES ON DATABASE baza_tag to strona_user;
GRANT

But nothing happends:

usename   | usesysid | usecreatedb | usesuper | usecatupd | userepl |  passwd  | valuntil | useconfig 
-------------+----------+-------------+----------+-----------+---------+----------+----------+-----------
postgres    |       10 | t           | t        | t         | t       | ******** |          | 
zielony     |    16384 | t           | t        | t         | t       | ******** |          | 
strona_user |    16440 | f           | f        | f         | f       | ******** |          | 

Also I don't have any access via php. What am i missing?

like image 513
zie1ony Avatar asked Feb 25 '12 18:02

zie1ony


People also ask

How do I check grant permissions in PostgreSQL?

Another way to do this is to use the information_schema schema and query the table_privileges table as: $ SELECT * FROM information_schema. table_privileges LIMIT 5; The above query will show detailed information about user privileges on databases as well as tables.


1 Answers

Postgresql rights system doesn't work like that. You will have to set rights on the objects them selves. Like so:

GRANT ALL ON ALL TABLES IN SCHEMA public TO strona_user;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO strona_user;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO strona_user;
like image 117
Eelke Avatar answered Sep 23 '22 13:09

Eelke