Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jAIMd-000663-Hs for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2020 19:10:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jAIMc-00031s-Cr for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2020 19:10:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jAIMc-00031l-0q for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2020 19:10:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jAIMX-0004jX-64 for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2020 19:10:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 026JAHtx016027; Fri, 6 Mar 2020 14:10:17 -0500 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: Symbolic names for the values of typalign and typstorage In-reply-to: <20200306181826.ls7i2espox52epaq@alap3.anarazel.de> References: <16457.1583189537@sss.pgh.pa.us> <20200306181826.ls7i2espox52epaq@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 06 Mar 2020 10:18:26 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16025.1583521817.1@sss.pgh.pa.us> Date: Fri, 06 Mar 2020 14:10:17 -0500 Message-ID: <16026.1583521817@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > 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? I did think about that, but since the underlying storage needs to be a "char", I'm not sure that using an enum for the values would really be all that helpful. We might get warnings from pickier compilers, and we wouldn't necessarily get the warnings we actually want. regards, tom lane