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

From Gauthier, Dave
Subject Setting default privs for a user doesn't seem to work.
Date
Msg-id 0AD01C53605506449BA127FB8B99E5E13E1173A9@FMSMSX105.amr.corp.intel.com
Whole thread Raw
Responses Re: Setting default privs for a user doesn't seem to work.  ("David Johnston" <polobo@yahoo.com>)
Re: Setting default privs for a user doesn't seem to work.  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general

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...

 

 

fcadsql7> psql sde

psql (9.1.5)

Type "help" for help.

 

sde=# \du

                             List of roles

Role name |                   Attributes                   | Member of

-----------+------------------------------------------------+-----------

insert    |                                                | {}

pgdbadm   | Superuser, Create role, Create DB, Replication | {}

select    |                                                | {} <-- the "select" user

 

 

sde=# alter default privileges for user "select" grant select on tables to "select";

ALTER DEFAULT PRIVILEGES

sde=# alter default privileges for user "select" grant select on sequences to "select";

ALTER DEFAULT PRIVILEGES

sde=# alter default privileges for user "select" grant execute on functions to "select";

ALTER DEFAULT PRIVILEGES

 

"select" user should now get 'select' priv for all future tables and sequences, and execute functions.

 

sde=#

sde=# create table foo (a text);  <-- note, the "postgres" user is creating the foo table, not "select"

CREATE TABLE

sde=# insert into foo (a) values ('aaa'), ('bbb');

INSERT 0 2

sde=# select * from foo;

  a

-----

aaa

bbb

(2 rows)

 

sde=# \q

fcadsql7> psql --user=select sde  <-- connect as "select" user and try to select from the new "foo" table. This fails.

psql (9.1.5)

Type "help" for help.

 

sde=> select * from foo;

ERROR:  permission denied for relation foo <--- Brrrrrt!

sde=>

 

pgsql-general by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: unlooged tables
Next
From: "David Johnston"
Date:
Subject: Re: Setting default privs for a user doesn't seem to work.