Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX)

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-16 10:29:16
Message-ID: CAPmGK17HSJaAn5RG15U2SV=XupGGyqtZ3FprxAELGuXcnL2C-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jul 16, 2024 at 5:01 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> writes:
> > 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.

Agreed. To be honest I am not sure if we can fix this issue, but if
so, I think that that would be going to require invasive changes to
the core and probably would not be back-patchable, so I will leave
this for future work.

Best regards,
Etsuro Fujita

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-07-16 12:45:15 Re: BUG #18542: Order by expression, that contains column from projection isn't working
Previous Message PG Bug reporting form 2024-07-16 09:12:36 BUG #18542: Order by expression, that contains column from projection isn't working