Re: [HACKERS] object_classes array is broken, again

From: Jaimin Pan <jaimin(dot)pan(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] object_classes array is broken, again
Date: 2015-07-22 00:53:53
Message-ID: CABP8UDSKXYeSjqbFXWsUVQb+wpZTBtHbF7UahemXE6d6Tb7e5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi all,

How about this patch. I believe it will never missing someone and be
detected while compiling.

2015-07-21 19:38 GMT+08:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:

> 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
>

Attachment Content-Type Size
fix.patch application/octet-stream 6.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2015-07-22 03:55:13 Re: [HACKERS] object_classes array is broken, again
Previous Message Michael Paquier 2015-07-21 23:57:07 Re: BUG #13508: Migration of version error

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2015-07-22 01:04:10 Re: "make check" changes have caused buildfarm deterioration.
Previous Message Andreas Karlsson 2015-07-22 00:52:46 Re: [PATCH] Reload SSL certificates on SIGHUP