Re: Refactor construct_array() and deconstruct_array() for built-in types - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: Refactor construct_array() and deconstruct_array() for built-in types
Date
Msg-id 87y1xdjei1.fsf@wibble.ilmari.org
Whole thread Raw
In response to Re: Refactor construct_array() and deconstruct_array() for built-in types  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
Responses Re: Refactor construct_array() and deconstruct_array() for built-in types
List 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



pgsql-hackers by date:

Previous
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: Refactor construct_array() and deconstruct_array() for built-in types
Next
From: Ranier Vilela
Date:
Subject: Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)