| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_plan_advice: FOREIGN_JOIN advice generated for a single-relation foreign scan is not round-trip safe |
| Date: | 2026-07-02 20:20:28 |
| Message-ID: | CA+TgmoZS60iG9w=2FY9kYOzLOm3euHh3CvBD66LdJNwQmvfVhw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jun 30, 2026 at 10:52 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jun 30, 2026 at 10:36 AM Mahendra Singh Thalor
> <mahi6run(at)gmail(dot)com> wrote:
> > While testing pg_plan_advice together with postgres_fdw, I noticed that the
> > advice generated for a single-relation foreign scan is not round-trip safe,
> > which contradicts the "round-trip safe" guarantee documented in
> > contrib/pg_plan_advice/README.
> >
> > When postgres_fdw pushes an aggregate down over a single foreign table, the
> > resulting ForeignScan has scanrelid == 0 but fs_relids names exactly one
> > relation. pg_plan_advice generates FOREIGN_JOIN(<rel>) advice for it. However,
> > the advice parser requires a FOREIGN_JOIN target to name more than one
> > relation, so feeding the generated advice back in fails to parse.
>
> Thanks for the report. I think this patch looks correct, but the
> comments are a bit overly verbose. Barring objections or other
> comments, I'll tighten this up, commit and back-patch.
Done. I ended up making some changes to the test case as well,
basically to make it less likely that it could accidentally pass.
--
Robert Haas
EDB: http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2026-07-02 20:24:32 | Re: implement CAST(expr AS type FORMAT 'template') |
| Previous Message | Pavel Stehule | 2026-07-02 20:04:40 | Re: proposal - queryid can be used as filter for auto_explain |