* 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