Re: How to create a read only user account to access to all pg database? - Mailing list pgsql-admin

From Stephen Frost
Subject Re: How to create a read only user account to access to all pg database?
Date
Msg-id 20151125132332.GU3685@tamriel.snowman.net
Whole thread Raw
In response to Re: How to create a read only user account to access to all pg database?  (Shreeyansh Dba <shreeyansh2014@gmail.com>)
List pgsql-admin
* Shreeyansh Dba (shreeyansh2014@gmail.com) wrote:
> A simple way is Create a user with superuser privileges and read only
> permission.
>
> -Login psql as postgres or other superuser.
> -Create the new superuser role and set it to read only :
>
> CREATE USER backupadmn WITH PASSWORD 'pwd' SUPERUSER ;
> ALTER USER backupadmn set default_transaction_read_only = on;

Uh, that doesn't create a read-only user, it just starts that user's
session out with the transaction being read only *by default*.

Do NOT use this to try and create read-only users.

The user can trivially change that if they have SQL access using begin:

----------------------
=# begin read write;
BEGIN
=*# alter user r1 set default_transaction_read_only = 0;
ALTER ROLE
=*# commit;
COMMIT
=#
----------------------

Thanks!

Stephen

Attachment

pgsql-admin by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Question on Hot Standby in PostgreSQL
Next
From: "Mailing Liste"
Date:
Subject: Update postgresql-9.1 fails