Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption

From: Önder Kalacı <onderkalaci(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption
Date: 2024-05-30 07:15:10
Message-ID: CACawEhVBz3Em2T9=Xe==n5xtHshs7+DQ7tUqN21TFE76tN4Arw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

and 2) ORDER BY must already
> > have been determined to be safe to push down before we get here.
>

When I read the code, the decision for that seems to happen in the next
line where this patch proposes to modify:

/*
> * Also, the LIMIT/OFFSET cannot be pushed down, if their expressions are
> * not safe to remote.
> */
> if (!is_foreign_expr(root, input_rel, (Expr *) parse->limitOffset) ||
> !is_foreign_expr(root, input_rel, (Expr *) parse->limitCount))
> return;

Hence, I thought it is OK to add this new check to this place.

So
> > in that case, if getting here, we can consider that WITH TIES is also
> > safe to push down (if the remote is v13 or later).

See Tom's response here on why it might not be a good idea to pushdown
WITH TIES:
https://www.postgresql.org/message-id/2114796.1715878709%40sss.pgh.pa.us

I think, at least not with this patch, this patch is like a bug-fix. If
intended, it should be possible to
pushdown WITH TIES with a follow-up patch?

Thanks,
Onder

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2024-05-30 09:10:44 Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning
Previous Message Daniel Gustafsson 2024-05-30 06:25:00 Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning