Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHVsw-0006dr-4k for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Jul 2015 11:38:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHVsv-0004bC-9I for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Jul 2015 11:38:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZHVss-0004XL-Pu; Tue, 21 Jul 2015 11:38:54 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZHVsn-0006SO-4h; Tue, 21 Jul 2015 11:38:53 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [89.176.99.192]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 566B8400642; Tue, 21 Jul 2015 04:38:41 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 4D44571E; Tue, 21 Jul 2015 13:38:39 +0200 (CEST) Date: Tue, 21 Jul 2015 13:38:39 +0200 From: Alvaro Herrera To: Tom Lane Cc: Robert Haas , Jim Nasby , Jaimin Pan , Michael Paquier , "pgsql-hackers@postgresql.org" , pgsql-bugs@postgresql.org Subject: Re: [BUGS] object_classes array is broken, again Message-ID: <20150721113839.GD5596@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <31003.1437414528@sss.pgh.pa.us> <29788.1437411581@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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