On 7/8/25 18:46, Mat Arye wrote:
It would be nice to force a connection into read-only mode. Connection setup is usually not AI controlled while the SQL executed sometimes is. That's why being able to control read-only mode on the connection level would be useful.

I'd be happy to submit a patch if there is interest in this feature (especially if I get some pointers to where people would like to see this implemented).

I believe the pg_readonly [1] extension does what you're looking for, so you might want to give it a try.

Could you share a bit more about your situation? For example, are you thinking of making specific users read-only, or do you want all database connections to be read-only? Also, which commands do you want to restrict? For instance, vacuum isn't a DML command, but it can still change the state of table pages and pg_catalog.

[1] https://github.com/pierreforstmann/pg_readonly

--
regards, Andrei Lepikhov,
pgEdge


Reply via email to