My goal is to start the psql client with read-only transactions as the default. I can get this behaviour my manually setting default_transaction_read_only once psql has started (e.g. SET default_transaction_read_only TO on), but I don't want to have to do that.
Theoretically this seems like it should work:
psql --set=default_transaction_read_only=on mydb myuser
But it doesn't, probably due to the caveat mentioned here:
These assignments are done during a very early stage of start-up, so variables reserved for internal purposes might get overwritten later.
Is there a way to do this, ideally with a single command line invocation?
Probably with ALTER ROLE ... SET ..., or could put that in your ".psqlrc".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With