From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
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: [BUGS] object_classes array is broken, again
Date: Tue, 21 Jul 2015 13:38:39 +0200
Message-ID: <20150721113839.GD5596@postgresql.org> (raw)
In-Reply-To: <31003.1437414528@sss.pgh.pa.us> <29788.1437411581@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Tom Lane wrote:
> I wrote:
> > +1 to this patch, in fact I think we could remove MAX_OCLASS altogether
> > which would be very nice for switch purposes.
>
> Oh, wait, I forgot that the patch itself introduces another reference to
> MAX_OCLASS. I wonder though if we should get rid of that as an enum value
> in favor of #define'ing a LAST_OCLASS macro referencing the last enum
> item, or some other trick like that. It's certainly inconvenient in
> event_trigger.c to have a phony member of the enum.
Yeah, that works well enough. Pushed that way.
> Are there any other arrays that need such tests?
I looked around with this:
git grep 'const.*\[.*[^][0-9].*\].*=.*{'
and found one suspicious-looking use of MAX_ACL_KIND which we could
perhaps define in a way equivalent to what we've done here. We also
have RM_MAX_ID in a couple of arrays but that looks safe because both
the values and the arrays are auto-generated.
We also have MAX_TIME_PRECISION, MAX_TIMESTAMP_PRECISION,
MAX_INTERVAL_PRECISION, MAXDATEFIELDS, KeyWord_INDEX_SIZE, but these
don't look likely to actually cause any trouble.
(There are many arrays sized to numerical constants, but there are about
5000 of those and I'm not in a hurry to verify how they are used.)
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, Jim.Nasby@BlueTreble.com, jaimin.pan@gmail.com, michael.paquier@gmail.com, pgsql-bugs@postgresql.org
Subject: Re: [BUGS] object_classes array is broken, again
In-Reply-To: <20150721113839.GD5596@postgresql.org>
References: <20150721113839.GD5596@postgresql.org>
* 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