Re: pg_plan_advice

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Dian Fay <di(at)nmfay(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_plan_advice
Date: 2026-01-19 18:59:28
Message-ID: CA+TgmoaUZsq2gBQh-jANrjFZ7bshzKFQPgDoY2OuFB1bgByUqg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 16, 2026 at 1:14 PM Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> Nice! With v10, the next crash comes from pgpa_walker_would_advise()
> (from a code branch that has its own copy of the "cannot determine RTI
> for advice target" error, so I assume it's a similar issue?).

Actually, GATHER(((x))) should be rejected as invalid syntax. I
believe this is the correct fix:

-generic_sublist: '(' generic_target_list ')'
+generic_sublist: '(' simple_target_list ')'

If you say GATHER((a b c)), that means "put a Gather node on top of
the join between a, b, and c". If you say GATHER(a b c), that means
"put a Gather node on top of each of a, b, and c individually" i.e.
create a plan with three completely separate Gather nodes. GATHER(((a
b c))) is meaningless. The only plan advice type where we need
arbitrarily deep nesting is JOIN_ORDER(), because there we use
sublists to denote bushy or right-deep joins. Otherwise, we should be
limited to no sublists at all for things like SEQ_SCAN and NO_GATHER,
and to a single level for most other advice tags.

Fixup patch attached. Thanks VERY much for the continued testing.

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
too-much-nesting.patch.nocfbot application/octet-stream 2.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2026-01-19 19:00:00 Re: Logical Replication of sequences
Previous Message Tom Lane 2026-01-19 18:56:49 Re: 001_password.pl fails with --without-readline