Re: Beta time - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Beta time
Date
Msg-id 27363.1000876077@sss.pgh.pa.us
Whole thread Raw
In response to Re: Beta time  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Beta time
Re: Beta time
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> Attached is the CONSTR_PRIMARY switch block from command.c.  I've marked the
> problem test with '@@'.

Hmmm .... this code has got a number of problems, but I don't see why
*that* would fail.  Anyone?

What I do see:

1. Should not "break" out of loop over indexes after detecting a
matching non-primary-key index.  This allows detection of the NOTICE
condition to distract you from detecting the ERROR condition on a
later index.  I'd suggest issuing the NOTICE inside the loop, actually,
and not breaking at all.  (See also #4)

2. What's with the "if (keyno > 0)"?  That breaks detection of
everything on indexes on system columns, eg OID.  (Of course, the
"rel_attrs[keyno - 1]" reference doesn't work for system columns,
but sticking your head in the sand is no answer.)

3. pfree'ing iname at the bottom doesn't strike me as a good
idea; isn't that possibly part of your input querytree?

4. If you're going to be so pedantic as to issue a warning notice about
a duplicate non-primary index, it'd be polite to give the name of that
index.  Else how shall I know which index you think I should drop?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Beta time
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Beta time