Search Postgresql Archives

Re: Setting default privs for a user doesn't seem to work.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux