generating bootstrap entries for array types - Mailing list pgsql-hackers

From John Naylor
Subject generating bootstrap entries for array types
Date
Msg-id CAJVSVGVTb6m9pJF49b3SuA8J+T-THO9c0hxOmoyv-yGKh-FbNg@mail.gmail.com
Whole thread Raw
Responses Re: generating bootstrap entries for array types  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
List pgsql-hackers
I wrote [1]:

> On 4/26/18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> if I counted correctly.  (Array entries should be ignored for this
>> purpose; maybe we'll autogenerate them someday.)
>
> Hmm, that wouldn't be too hard. Add a new metadata field called
> 'array_type_oid', then if it finds such an OID, teach genbki.pl to
> construct a tuple for the corresponding array type by consulting
> something like
>
> char    typcategory    BKI_ARRAY(A);
> char    typstorage      BKI_ARRAY(x);
> ...etc
>
> in the header file, plus copying typalign from the element type. I'll
> whip this up sometime and add it to the next commitfest.

This turned out to be slightly more complicated than that, but still
pretty straightforward. The script is for information only, it doesn't
need to be run.

-typalign for arrays is 'i' unless the element type is 'd', in which
case it's 'd'.
-If future array-like types are created that break the model and so
can't be generated from the element type, they have an escape hatch of
having their own full entry. Currently this includes  _record, since
it's a pseudotype, and of course the special types oidvector and
int2vector.
-I've kept the current convention of duplicating typdelim in the array
type, although I'm not sure it's used anywhere.

If you sort the before and after postgres.bki, it should result in a clean diff.

Will add to next commitfest.

--
[1] https://www.postgresql.org/message-id/CAJVSVGW-D7OobzU%3DdybVT2JqZAx-4X1yvBJdavBmqQL05Q6CLw%40mail.gmail.com

-John Naylor

Attachment

pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: FindDefinedSymbol() is subtly broken
Next
From: Michael Paquier
Date:
Subject: Re: pg_control read error message