pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: eric.cyr@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX)
Date: Mon, 15 Jul 2024 16:01:02 -0400
Message-ID: <3195560.1721073662@sss.pgh.pa.us> (raw )
In-Reply-To: <CAPmGK17Rcmr+YLbzdcbs5ApnP-uGieTy81+0R1TPAeffEs19Cg@mail.gmail.com >
References: <17889-e8c39a251d258dda@postgresql.org >
<CAPmGK17vjjy0Yb=jyK_iCL5rpGW7w1imv=kQB7rkk9xMO4cEjA@mail.gmail.com >
<CAPmGK16DNvnReiNyKprn4O-j5S2uGzUrcDANaF49md1-ejjjQw@mail.gmail.com >
<CAPmGK14u-jGV-4B2_T90Lf5U5Az2d5wH0hV3vfUbWkw2d4UjBA@mail.gmail.com >
<1852635.1682808624@sss.pgh.pa.us >
<CAPmGK149UubRQGLH6QaBkhJvas+Gz+T6tx2MBX9MTJpxDRKPBA@mail.gmail.com >
<CAPmGK17-1hPixcv0=t6UYjb5=p9qryr-O0BGoNvcUuGw_pRWtA@mail.gmail.com >
<3147482.1721051728@sss.pgh.pa.us >
<CAPmGK17Rcmr+YLbzdcbs5ApnP-uGieTy81+0R1TPAeffEs19Cg@mail.gmail.com >
Etsuro Fujita <etsuro.fujita@gmail.com> writes:
> On Mon, Jul 15, 2024 at 10:55 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Uh ... does this ensure that the data hasn't changed?
> postgres_fdw opens a remote transaction using REPEATABLE READ or
> SERIALIZABLE, so the recreated cursor uses the same snapshot except
> changes made by the remote transaction.
Ah, right.
> This causes eg, a join-UPDATE query where multiple rows join to the
> same foreign target row to repeatedly update the target row, as shown
> below, which would never happen if rewinding the cursor.
> ...
> Note that postgres_fdw already recreates a cursor when doing a rescan
> with parameter changes, so we already have this issue. IMO I think we
> should avoid writing a query like this.
Hmm. In principle, since postgres_fdw controls all the SQL sent to
the remote side, we could avoid building problematic queries. But
I'm not sure how to make that work in practice, or how we'd avoid
somebody carelessly breaking it in future. It seems like the
property you propose requiring is a second-order effect that would
be hard to ensure.
regards, tom lane
view thread (12+ messages) latest in thread
Message-ID: <3195560.1721073662@sss.pgh.pa.us>
Permalink: ../3195560.1721073662@sss.pgh.pa.us/
Also on: postgresql.org/message-id/3195560.1721073662@sss.pgh.pa.us
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, etsuro.fujita@gmail.com, eric.cyr@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX)
In-Reply-To: <3195560.1721073662@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox