Re: Grant read-only access to exactly one database amongst many

2024-02-05 Thread David G. Johnston
On Monday, February 5, 2024, Graham Leggett wrote: > > Also, how do you handle the race condition between the time a database db3 > is created, and the the time all readonly users have their access revoked > to db3? > > You alter the default privileges for the system so PUBLIC does not get connec

Re: Grant read-only access to exactly one database amongst many

2024-02-05 Thread Graham Leggett
On 05 Feb 2024, at 00:54, David G. Johnston wrote: > I have a postgresql 15 instance with two databases in it, and I have a need > to grant read-only access to one of those databases to a given user. >> >> To do this I created a dedicated role for readonly access to the database >> db1: >> >>

Re: Grant read-only access to exactly one database amongst many

2024-02-04 Thread David G. Johnston
On Sun, Feb 4, 2024 at 5:04 PM Graham Leggett wrote: > Hi all, > > I have a postgresql 15 instance with two databases in it, and I have a > need to grant read-only access to one of those databases to a given user. > > To do this I created a dedicated role for readonly access to the database > db1

Re: Grant read-only access to exactly one database amongst many

2024-02-04 Thread Tom Lane
Graham Leggett writes: > Trouble is, I can create tables in db1 which is write access. I can also > connect to db2 (bad), and I can enumerate the tables in db2 (bad), although > the queries of the contents say access is denied. You need to read the docs about default privileges: see about halfw