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/