Re: postgres_fdw: transaction mode inheritance corner cases

From: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
To: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: postgres_fdw: transaction mode inheritance corner cases
Date: 2026-10-01 16:47:33
Message-ID: CAM527d_iZYxz9osL1Wra5=n0+WPTv3N3X-_3_XgVsd+EkTscdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 30, 2026 at 11:27 AM Matheus Alcantara
<matheusssilv97(at)gmail(dot)com> wrote:
> With the patch, the new begin_remote_xact() call in create_cursor opens a
> remote SAVEPOINT s2 and creates the cursor inside it. ROLLBACK TO s1 then
> destroys the remote cursor while the local side still thinks it exists.

Thanks, Matheus. My AI harness for testing reproduced this on
REL_19_STABLE at 9e73b209 with Etsuro's v1 patch and prepared the
attached incremental patch. It declares the remote cursor before
advancing the remote savepoint level, then synchronizes the transaction
mode before FETCH. The second FETCH fails with 34000 on v1 and succeeds
with this patch.

The postgres_fdw suite passes (4/4). This does not address the hot
standby case, which needs a separate fix.

Nik

Attachment Content-Type Size
v1-0001-postgres_fdw-preserve-outer-cursors-on-rollback.patch application/x-patch 4.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-10-01 16:49:06 Re: COMMENTS are not being copied in CREATE TABLE LIKE
Previous Message Rui Zhao 2026-10-01 16:44:13 Re: fix more casting away of qualifiers