pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bo Victor Thomsen <bo.victor.thomsen@gmail.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Setting up a database with minimum access rights
Date: Sun, 26 Apr 2020 21:36:51 +0200
Message-ID: <90829287-de11-7949-061c-5eb914b73393@gmail.com> (raw)
In-Reply-To: <CAMkU=1wKgv9SC9J-QCZhgWa0-7=bSnQNLD0Ox0pay3ssX52biA@mail.gmail.com>
References: <b41dd282-c77f-1fe4-bb44-ef8308562c51@gmail.com>
	<CAMkU=1wKgv9SC9J-QCZhgWa0-7=bSnQNLD0Ox0pay3ssX52biA@mail.gmail.com>

Hi Jeff -

Spot on !!  (Right hand reaching for the Postgres manual,  left hand 
searching for "Brown paper bag to pull over head" )

I was executing the script with user "postgres" and creating the table 
with another user "greenadm_adm".

With the missing qualifier "FOR USER.."  in the "ADD DEFAULT 
PRIVILEGES.. " command, the command only works for tables created by 
user "postgres".

Using the same user for both scripting and creating tables works.

I owe you a large cold beer (or whatever beverage you prefer) If we ever 
meet in person :-)

-- 
Med venlig hilsen / Kind regards

Bo Victor Thomsen

Den 26-04-2020 kl. 19:37 skrev Jeff Janes:
> On Sun, Apr 26, 2020 at 12:57 PM Bo Victor Thomsen 
> <bo.victor.thomsen@gmail.com <mailto:bo.victor.thomsen@gmail.com>> wrote:
>
> ...
>
>     After execution of the above commands, I create a table in schema
>     "data_schema" using the "postgres" superuser. But I can't access the
>     created table with user "loki"
>
>
> Were all the above steps executed as "postgres", or was just the 
> CREATE TABLE statement done as that user?
>
> If it is all done as "postgres" superuser then it works for me.  Your 
> example ALTER DEFAULT PRIVILEGES without specifying the FOR ROLE only 
> applies to objects created by the same user who executed the ALTER 
> DEFAULT PRIVILEGES.
>
> Cheers,
>
> Jeff

view thread (3+ messages)

Message-ID: <90829287-de11-7949-061c-5eb914b73393@gmail.com>
Permalink:  ../90829287-de11-7949-061c-5eb914b73393@gmail.com/
Also on:    postgresql.org/message-id/90829287-de11-7949-061c-5eb914b73393@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: bo.victor.thomsen@gmail.com, jeff.janes@gmail.com
  Subject: Re: Setting up a database with minimum access rights
  In-Reply-To: <90829287-de11-7949-061c-5eb914b73393@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox