refactor ExecInitPartitionInfo

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: refactor ExecInitPartitionInfo
Date: 2025-11-28 11:00:08
Message-ID: CACJufxEN_mmgTtp-raJ9-VJHgyAGmb0SrO+01kn5by4mJ_XOfw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

I noticed the following code pattern repeated several times in
ExecInitPartitionInfo.
```
if (part_attmap == NULL)
build_attrmap_by_name(RelationGetDescr(partrel),
RelationGetDescr(firstResultRel),
false);
```

we can consolidated into one, like:

+ if (node != NULL &&
+ (list_length(node->withCheckOptionLists) > 0 ||
+ list_length(node->returningLists) > 0 ||
+ node->onConflictAction != ONCONFLICT_NONE ||
+ node->operation == CMD_MERGE))
+ {
+ part_attmap =
+ build_attrmap_by_name(RelationGetDescr(partrel),
+ RelationGetDescr(firstResultRel),
+ false);
+ }
+

it matters, because nearby patch ON CONFLICT DO SELECT is= going to add another
one.

what do you think?

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

Attachment Content-Type Size
v1-0001-refactor-ExecInitPartitionInfo.patch text/x-patch 3.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2025-11-28 11:16:45 Re: Proposal: adding --enable-shadows-warning
Previous Message Jim Jones 2025-11-28 10:48:28 Re: [PoC] XMLCast (SQL/XML X025)