From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> |
Cc: | eric(dot)cyr(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX) |
Date: | 2024-07-15 20:01:02 |
Message-ID: | 3195560.1721073662@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> writes:
> On Mon, Jul 15, 2024 at 10:55 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-07-16 01:00:52 | Re: BUG #18540: Does PG16 standby database support function pg_replication_origin_advance? |
Previous Message | Etsuro Fujita | 2024-07-15 19:45:48 | Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX) |