Re: Read-only connection mode for AI workflows. - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: Read-only connection mode for AI workflows.
Date
Msg-id 64f1c69a-ceff-4b17-8298-58f255d075fc@gmail.com
Whole thread Raw
In response to Read-only connection mode for AI workflows.  (Mat Arye <mat@tigerdata.com>)
Responses Re: Read-only connection mode for AI workflows.
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: pgcrypto/des tests fail on riscv64 due to clang's code generation anomaly
Next
From: Jacob Champion
Date:
Subject: Re: Improve OAuth discovery logging