Re: Symbolic names for the values of typalign and typstorage

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Symbolic names for the values of typalign and typstorage
Date: 2020-03-06 18:18:26
Message-ID: 20200306181826.ls7i2espox52epaq@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2020-03-02 17:52:17 -0500, Tom Lane wrote:
> While looking at Tomas' ALTER TYPE patch, I got annoyed by the fact
> that all of the backend writes constants of type alignment and type
> storage values as literal characters, such as 'i' and 'x'. This is
> not our style for most other "poor man's enum" catalog columns, and
> it makes it really hard to grep for relevant code. Hence, attached
> is a proposed patch to invent #define names for those values.

Independent of the patch, why aren't we using proper enums for some of
these? There's plenty code that tries to handle all variants for various
such "poor man's enum"s - the current compiler doesn't allow the
compiler to help defend against forgotten values. And I think there's
plenty cases where we *did* forget updating places for new values,
e.g. around the partitioned table reltype.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-03-06 18:20:53 move DECLARE_INDEX from indexing.h?
Previous Message Andres Freund 2020-03-06 18:13:25 Re: Fastpath while arranging the changes in LSN order in logical decoding