Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-06-01 Thread Etsuro Fujita
On Sun, May 25, 2025 at 2:39 PM Etsuro Fujita wrote: > Here is a new version of the patch where I added a comment for a new > function, fixed indentation, and added the commit message. If there > are no objections, I will push this as a master-only fix, as noted in > the commit message. Pushed a

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-05-24 Thread Etsuro Fujita
On Thu, May 8, 2025 at 5:50 PM Etsuro Fujita wrote: > Attached is an updated version of the patch. Here is a new version of the patch where I added a comment for a new function, fixed indentation, and added the commit message. If there are no objections, I will push this as a master-only fix, as

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-05-08 Thread Etsuro Fujita
On Sun, May 4, 2025 at 9:30 PM Etsuro Fujita wrote: > As read-only > subtransactions can’t change to read-write, and a read-only > main-transaction can’t change to read-write after first snapshot, > either (note: begin_remote_xact is called after it), all we need to do > is track the nesting level

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-05-04 Thread Etsuro Fujita
On Sun, Mar 30, 2025 at 7:14 PM Etsuro Fujita wrote: > On Thu, Mar 27, 2025 at 1:25 PM Ashutosh Bapat > wrote: > > On Tue, Mar 25, 2025 at 4:01 PM Etsuro Fujita > > wrote: > > > In the patch I also fixed a bug; I trusted XactReadOnly to see if the > > > local transaction is READ ONLY, but I not

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-30 Thread Etsuro Fujita
On Thu, Mar 27, 2025 at 1:25 PM Ashutosh Bapat wrote: > On Tue, Mar 25, 2025 at 4:01 PM Etsuro Fujita wrote: > > In the patch I also fixed a bug; I trusted XactReadOnly to see if the > > local transaction is READ ONLY, but I noticed that that is not 100% > > correct, because a transaction which s

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-27 Thread Ashutosh Bapat
On Tue, Mar 25, 2025 at 4:01 PM Etsuro Fujita wrote: > > In the patch I also fixed a bug; I trusted XactReadOnly to see if the > local transaction is READ ONLY, but I noticed that that is not 100% > correct, because a transaction which started as READ WRITE can show as > READ ONLY later within sub

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-25 Thread Etsuro Fujita
On Mon, Mar 3, 2025 at 1:51 PM Ashutosh Bapat wrote: > On Sun, Mar 2, 2025 at 5:14 PM Etsuro Fujita wrote: > > postgres_fdw opens remote transactions in read/write mode in a local > > transaction even if the local transaction is read-only. I noticed > > that this leads to surprising behavior lik

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-25 Thread Etsuro Fujita
On Mon, Mar 3, 2025 at 4:49 PM Tom Lane wrote: > Ashutosh Bapat writes: > > On Sun, Mar 2, 2025 at 5:14 PM Etsuro Fujita > > wrote: > >> To avoid that, I would like to propose a server option, > >> inherit_read_only, to open the remote transactions in read-only mode > >> if the local transactio

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-03 Thread Tom Lane
Ashutosh Bapat writes: > On Sun, Mar 2, 2025 at 5:14 PM Etsuro Fujita wrote: >> To avoid that, I would like to propose a server option, >> inherit_read_only, to open the remote transactions in read-only mode >> if the local transaction is read-only. > Why do we need a server option. Either we sa

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-03 Thread Ashutosh Bapat
Hi Fujita-san, On Sun, Mar 2, 2025 at 5:14 PM Etsuro Fujita wrote: > > Hi, > > postgres_fdw opens remote transactions in read/write mode in a local > transaction even if the local transaction is read-only. I noticed > that this leads to surprising behavior like this: > > CREATE TABLE test (a in

Re: Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-02 Thread Etsuro Fujita
On Sun, Mar 2, 2025 at 12:44 PM Etsuro Fujita wrote: > Attached is a small patch for these options. I will add this to the > March commitfest as it is still open. The CF was changed to in-progress just before, so I added it to the next CF. Best regards, Etsuro Fujita

Options to control remote transactions’ access/deferrable modes in postgres_fdw

2025-03-02 Thread Etsuro Fujita
Hi, postgres_fdw opens remote transactions in read/write mode in a local transaction even if the local transaction is read-only. I noticed that this leads to surprising behavior like this: CREATE TABLE test (a int); CREATE FUNCTION testfunc() RETURNS int LANGUAGE SQL AS 'INSERT INTO public.test