Re: Symbolic names for the values of typalign and typstorage - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Symbolic names for the values of typalign and typstorage
Date
Msg-id 20200306181826.ls7i2espox52epaq@alap3.anarazel.de
Whole thread Raw
In response to Symbolic names for the values of typalign and typstorage  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Symbolic names for the values of typalign and typstorage
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Fastpath while arranging the changes in LSN order in logicaldecoding
Next
From: Alvaro Herrera
Date:
Subject: move DECLARE_INDEX from indexing.h?