Postgres 9.1 GRANT does not work

zie1ony picture zie1ony · Feb 25, 2012 · Viewed 14.6k times · Source

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?

Answer

Eelke picture Eelke · Feb 25, 2012

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;