| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Lukas Fittl <lukas(at)fittl(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_plan_advice |
| Date: | 2026-04-06 19:52:51 |
| Message-ID: | CA+TgmoaS3fWeyyfKtX93NhmAh=bd0auqW_+XgcTJ5rrMr4qo9w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Apr 5, 2026 at 4:00 AM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
> I and SQLsmith have discovered one more anomaly (reproduced starting from
> e0e4c132e):
> load 'test_plan_advice';
> select object_type from
> (select object_type from information_schema.element_types limit 1),
> lateral
> (select sum(1) over (partition by a) from generate_series(1, 2) g(a) where false);
>
> triggers an internal error:
> ERROR: XX000: no rtoffset for plan unnamed_subquery
> LOCATION: pgpa_plan_walker, pgpa_walker.c:110
>
> Could you please have a look?
Thanks for the report. What seems to be happening here is that the
whole query is replaced by a single Result node, since the join must
be empty. But that means that unnamed_subquery doesn't make it into
the final plan tree, and then pgpa_plan_walker() is sad about not
finding it. Normally it wouldn't care, but apparently this query
involves at least one semijoin someplace that the planner considered
converting into a regular join with one side made unique, so
pgpa_plan_walker() has an entry in sj_unique_rels and then wants to
adjust that entry for the final, flattened range table, and it can't.
I'm inclined to think that the fix is just:
- elog(ERROR, "no rtoffset for plan %s", proot->plan_name);
+ continue;
...plus a comment update, but I want to spend some time mulling over
whether that might break anything else before I go do it.
--
Robert Haas
EDB: http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Haibo Yan | 2026-04-06 19:55:29 | Re: Extract numeric filed in JSONB more effectively |
| Previous Message | Lukas Fittl | 2026-04-06 19:50:59 | Re: Add custom EXPLAIN options support to auto_explain |