Re: pg_plan_advice - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_plan_advice
Date
Msg-id CA+TgmoaUZsq2gBQh-jANrjFZ7bshzKFQPgDoY2OuFB1bgByUqg@mail.gmail.com
Whole thread Raw
In response to Re: pg_plan_advice  (Jacob Champion <jacob.champion@enterprisedb.com>)
List pgsql-hackers
On Fri, Jan 16, 2026 at 1:14 PM Jacob Champion
<jacob.champion@enterprisedb.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 001_password.pl fails with --without-readline
Next
From: Alexander Lakhin
Date:
Subject: Re: Logical Replication of sequences