Re: refactor ExecInitPartitionInfo

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Andreas Karlsson <andreas(at)proxel(dot)se>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refactor ExecInitPartitionInfo
Date: 2026-04-01 13:12:54
Message-ID: CACJufxFX_pTuBnQKoDP56ChcRiYdN+54KZnf99vo7MqVWrXmYw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 23, 2026 at 10:28 AM Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>
> > if (node != NULL)
> > part_attmap = build_attrmap_by_name(RelationGetDescr(partrel),
> > RelationGetDescr(firstResultRel),
> > false);
> >
> > We have now consolidated five uses of build_attrmap_by_name into one.
>
> Hm, why would that be ok? As far as I can tell the current code tries
> hard to not build the attmap unless it is actually needed while you
> propose to build it almost unconditionally. While the code is less
> complicated with your patch it instead has to do more work in some
> cases, right?
>

Ok. I switched it back to

+ if (node &&
+ (node->withCheckOptionLists != NIL ||
+ node->returningLists != NIL ||
+ node->onConflictAction == ONCONFLICT_UPDATE ||
+ node->onConflictWhere ||
+ node->operation == CMD_MERGE))
+ {
+ /* later map_variable_attnos need use attribute map, build it now */
+ part_attmap = build_attrmap_by_name(RelationGetDescr(partrel),
+ RelationGetDescr(firstResultRel),
+ false);
+ }
+

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v3-0001-refactor-ExecInitPartitionInfo.patch text/x-patch 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-04-01 13:18:15 Re: Online PostgreSQL version() updates
Previous Message Pavlo Golub 2026-04-01 12:49:05 Re[2]: [PATCH] pg_stat_statements: add last_execution_start column