Re: clearing opfuncid vs. parallel query - Mailing list pgsql-hackers

From Noah Misch
Subject Re: clearing opfuncid vs. parallel query
Date
Msg-id 20151110040210.GA1189933@tornado.leadboat.com
Whole thread Raw
In response to Re: clearing opfuncid vs. parallel query  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Oct 22, 2015 at 05:14:29PM -0400, Robert Haas wrote:
> On Thu, Oct 22, 2015 at 5:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Robert Haas <robertmhaas@gmail.com> writes:
> >> Despite everybody's best efforts, we mess this up more than is really
> >> desirable. Commit b8fe12a83622b350dc6849f8bb933bd8a86c1424 fixed bugs
> >> in a whole bunch of preceding commits, and I wonder if anybody else
> >> would have found those if Noah hadn't.  It's just too easy to miss
> >> these things today.  If generating the .c files isn't practical,
> >> another alternative worth exploring would be a tool to cross-check
> >> them against the .h files.

FWIW, such a tool found the bugs I fixed in 53bbc68, b5eccae, b8fe12a.  My
script generates {copy,equal,out,read}funcs.c functions from the headers and
diffs each function against its hand-maintained counterpart.  I read through
the diff for anything suspicious.  (Most functions with deliberate nonstandard
behavior carry a comment about it.)

> > Yeah, I could get on board with that.  It doesn't seem terribly hard:
> > just make sure that all fields mentioned in the struct declaration are
> > mentioned in each relevant routine.  (Cases where we intentionally skip
> > a field could be handled by adding a no-op macro, eg "COPY_IGNORE(foo);")
> >
> > It would be nice if we could also check that the macro type is sane for
> > the field datatype (eg, not use COPY_SCALAR_FIELD() for a pointer field).
> > But that would probably increase the difficulty very substantially for
> > just a small gain in error detection.
> 
> I actually think that's quite an easy mistake to make, so I'd be happy
> if we could catch it.  But anything would be better than nothing.

So far, type mismatch defects have been no less common than neglecting a field
entirely.



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: CustomScan in a larger structure (RE: CustomScan support on readfuncs.c)
Next
From: Adam Brightwell
Date:
Subject: Re: bootstrap pg_shseclabel in relcache initialization