pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Refactor construct_array() and deconstruct_array() for built-in types
Date: Fri, 01 Jul 2022 11:47:50 +0100
Message-ID: <87y1xdjei1.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <871qv5kt9y.fsf@wibble.ilmari.org>
References: <2914356f-9e5f-8c59-2995-5997fc48bcba@enterprisedb.com>
	<1844517.1651502932@sss.pgh.pa.us>
	<c030a2ef-02d6-ccdb-8ebe-bc97df69be59@enterprisedb.com>
	<871qv5kt9y.fsf@wibble.ilmari.org>

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





view thread (7+ messages)  latest in thread

Message-ID: <87y1xdjei1.fsf@wibble.ilmari.org>
Permalink:  ../87y1xdjei1.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/87y1xdjei1.fsf@wibble.ilmari.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilmari@ilmari.org, peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us
  Subject: Re: Refactor construct_array() and deconstruct_array() for built-in types
  In-Reply-To: <87y1xdjei1.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox