From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jim Nasby <Jim.Nasby@BlueTreble.com>
Cc: Jaimin Pan <jaimin.pan@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: [HACKERS] object_classes array is broken, again
Date: Mon, 20 Jul 2015 12:59:41 -0400
Message-ID: <29788.1437411581@sss.pgh.pa.us> (raw)
In-Reply-To: <20150720163315.GS2301@postgresql.org>
References: <20150720101431.GJ2301@postgresql.org>
<13760.1437400153@sss.pgh.pa.us>
<20150720163315.GS2301@postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> What about adding StaticAsserts that lengthof() the relevant constant
>> arrays is equal to MAX_OCLASS? (Or other similar ways of checking
>> that they have the right number of entries.)
> Well, the array itself is declared like this:
> static const Oid object_classes[MAX_OCLASS] = {
> so testing lengthof() of it is useless because it's a constant and the
> assertion always holds. If it were declared like this instead:
> static const Oid object_classes[] = {
> then we could use lengthof().
Ah. I think the point of using MAX_OCLASS there was to get a warning
if the array was too short, but evidently it doesn't work like that.
> I don't see any drawwbacks to that.
+1 to this patch, in fact I think we could remove MAX_OCLASS altogether
which would be very nice for switch purposes.
Are there any other arrays that need such tests?
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, robertmhaas@gmail.com, Jim.Nasby@BlueTreble.com, jaimin.pan@gmail.com, michael.paquier@gmail.com, pgsql-bugs@postgresql.org
Subject: Re: [HACKERS] object_classes array is broken, again
In-Reply-To: <29788.1437411581@sss.pgh.pa.us>
References: <20150720101431.GJ2301@postgresql.org> <13760.1437400153@sss.pgh.pa.us> <20150720163315.GS2301@postgresql.org> <29788.1437411581@sss.pgh.pa.us>
* 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