Re: Defining a foreign key with a duplicate column is broken - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Defining a foreign key with a duplicate column is broken
Date
Msg-id 16463.1407606567@sss.pgh.pa.us
Whole thread Raw
In response to Re: Defining a foreign key with a duplicate column is broken  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
> On Sat, Aug 9, 2014 at 3:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> There's no need for a new error message I think, because we should just
>> ignore such indexes.  After all, there might be a valid matching index
>> later on.

> hmm, but if the user attempts to define the foreign key that contains a
> duplicate column in the REFERENCES part, then we'll never "find" any
> indexes, so there's no point in looking at all.

OK, now that I'm a bit more awake, I agree with that.

> I've attached a version of the patch that's a little smarter when it comes
> to doing the duplicate checks in the attnums array...

Applied with some cosmetic adjustments.  I didn't bother with the
regression test either --- this doesn't seem like something that needs
permanent memorialization as a regression test.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Reporting the commit LSN at commit time
Next
From: Stephen Frost
Date:
Subject: Re: jsonb format is pessimal for toast compression