Refactor construct_array() and deconstruct_array() for built-in types

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-05-02T08:38:59Z
Lists: pgsql-hackers

Attachments

[for PG16]

There are many calls to construct_array() and deconstruct_array() for 
built-in types, for example, when dealing with system catalog columns. 
These all hardcode the type attributes necessary to pass to these functions.

To simplify this a bit, add construct_array_builtin(), 
deconstruct_array_builtin() as wrappers that centralize this hardcoded 
knowledge.  This simplifies many call sites and reduces the amount of 
hardcoded stuff that is spread around.

I also considered having genbki.pl generate lookup tables for these 
hardcoded values, similar to schemapg.h, but that ultimately seemed 
excessive.

Thoughts?

Commits

  1. Add construct_array_builtin, deconstruct_array_builtin