Search code examples
postgresqlprivileges

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?


Solution

  • PostgreSQL rights system doesn't work like that. You will have to set rights on the objects themselves. 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;
    

    You may also need to grant privileges the your schema's.

    GRANT ALL ON SCHEMA public TO strona_user;