Re: [HACKERS] Foreign key bugs (Re: "New" bug?? Serious - crashes backend.)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, ryan <ryan(at)bel(dot)bc(dot)ca>, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Foreign key bugs (Re: "New" bug?? Serious - crashes backend.)
Date: 2000-07-11 16:03:25
Message-ID: 1018.963331405@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> Perhaps this coding convention is too error-prone and ought to be
>> changed to have two different routine names, say "heap_open[r]"
>> and "heap_open[r]_noerr". Opinions anyone?

> We already have heap_open and heap_openr. Seems another is too hard.
> Better to give them a parameter to control it. The API is confusing
> enough.

It is confusing, but we have here graphic evidence that the way it's
currently done is confusing. In a quick check, I found several other
cases of the same error that must have crept in over the past year or
so. So I'm now convinced that we'd better change the API of these
routines to make it crystal-clear whether you are getting a check for
open failure or not.

I like a different routine name better than a check-or-no-check
parameter. If you invoke the no-check case then you *MUST* have a check
for failure return --- forgetting to do this is exactly the problem.
So I think it should be harder to get at the no-check case, and you
should have to write something that reminds you that the routine is not
checking for you. Thus "heap_open_noerr" (I'm not particularly wedded
to that suffix, though, if anyone has a better idea for what to call
it). A parameter would only be useful if the same calling code might
reasonably do different things at different times --- but either there's
a check following the call, or there's not.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2000-07-11 16:03:57 Re: [HACKERS] Foreign key bugs (Re: "New" bug?? Serious - crashes backend.)
Previous Message Bruce Momjian 2000-07-11 15:34:35 Re: [HACKERS] Foreign key bugs (Re: "New" bug?? Serious - crashes backend.)

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-07-11 16:03:57 Re: [HACKERS] Foreign key bugs (Re: "New" bug?? Serious - crashes backend.)
Previous Message Lamar Owen 2000-07-11 15:58:25 Re: Distribution making