From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Gauthier, Dave *EXTERN*" <dave(dot)gauthier(at)intel(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Setting default privs for a user doesn't seem to work. |
Date: | 2012-12-07 08:59:39 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B05785DA1@ntex2010i.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dave Gauthier wrote:
> What's wrong with this picture. Trying (failing) to create a user called "select" with default select
> privs and nothing else. Demo below. Comments in red...
>
> sde=# alter default privileges for user "select" grant select on tables to "select";
> ALTER DEFAULT PRIVILEGES
>
> sde=# create table foo (a text); <-- note, the "postgres" user is creating the foo table, not
> "select"
> CREATE TABLE
>
> fcadsql7> psql --user=select sde <-- connect as "select" user and try to select from the new "foo"
> table. This fails.
>
> sde=> select * from foo;
> ERROR: permission denied for relation foo <--- Brrrrrt!
Sure, that's how it should be.
To allow "select" to read all tables that "postgres" creates, use
ALTER DEFAULT PRIVILEGES FOR USER "postgres" GRANT SELECT ON TABLES TO "select";
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Bartosz Dmytrak | 2012-12-07 09:28:15 | logs encoding problem Windows |
Previous Message | ac@hsk.hk | 2012-12-07 05:09:38 | Re: Ubutu 12.04 and PostgreSQL9.2.1 |