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