Re: Read-only connection mode for AI workflows.

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Mat Arye <mat(at)tigerdata(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Read-only connection mode for AI workflows.
Date: 2026-03-16 18:08:30
Message-ID: 64f1c69a-ceff-4b17-8298-58f255d075fc@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2026-03-16 18:14:08 Re: Improve OAuth discovery logging
Previous Message Alexander Lakhin 2026-03-16 18:00:00 Re: pgcrypto/des tests fail on riscv64 due to clang's code generation anomaly