Re: refactor ExecInitPartitionInfo - Mailing list pgsql-hackers

From jian he
Subject Re: refactor ExecInitPartitionInfo
Date
Msg-id CACJufxFX_pTuBnQKoDP56ChcRiYdN+54KZnf99vo7MqVWrXmYw@mail.gmail.com
Whole thread
In response to Re: refactor ExecInitPartitionInfo  (Andreas Karlsson <andreas@proxel.se>)
Responses Re: refactor ExecInitPartitionInfo
List pgsql-hackers
On Mon, Feb 23, 2026 at 10:28 AM Andreas Karlsson <andreas@proxel.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

pgsql-hackers by date:

Previous
From: "Pavlo Golub"
Date:
Subject: Re[2]: [PATCH] pg_stat_statements: add last_execution_start column
Next
From: Mihail Nikalayeu
Date:
Subject: Re: Online PostgreSQL version() updates