Re: Refactor construct_array() and deconstruct_array() for built-in types
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-07-01T10:47:50Z
Lists: pgsql-hackers
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> writes: > I dind't pay much attention to this thread earlier, but I was struck by > the duplication of the switch statement determining the elemlen, > elembyval, and elemalign values between the construct and deconstruct > functions. How about a common function they can both call? Something > like: > > static void builtin_type_details(Oid elemtype, > int *elemlen, > bool *elembyval, > char *elemalign); I just realised that this would require the error message to not include the function name (which isn't really that critical, since it's a developer-facing message), but an option would to make it return false for unknown types, so each of the calling functions can emit their own error message. > - ilmari
Commits
-
Add construct_array_builtin, deconstruct_array_builtin
- d746021de18b 16.0 landed