refactor ExecInitPartitionInfo - Mailing list pgsql-hackers

From jian he
Subject refactor ExecInitPartitionInfo
Date
Msg-id CACJufxEN_mmgTtp-raJ9-VJHgyAGmb0SrO+01kn5by4mJ_XOfw@mail.gmail.com
Whole thread Raw
List 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

pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: [PoC] XMLCast (SQL/XML X025)
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Proposal: adding --enable-shadows-warning