Re: Setting default privs for a user doesn't seem to work. - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Setting default privs for a user doesn't seem to work.
Date
Msg-id A737B7A37273E048B164557ADEF4A58B05785DA1@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Setting default privs for a user doesn't seem to work.  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List 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


pgsql-general by date:

Previous
From: "ac@hsk.hk"
Date:
Subject: Re: Ubutu 12.04 and PostgreSQL9.2.1
Next
From: Bartosz Dmytrak
Date:
Subject: logs encoding problem Windows