Re: Defining a foreign key with a duplicate column is broken

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Defining a foreign key with a duplicate column is broken
Date: 2014-08-09 03:34:30
Message-ID: 1104.1407555270@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> On Sat, Aug 9, 2014 at 12:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> So I'm thinking you're right: we should rewrite this code so that only
>> indexes having all columns distinct can match, thereby ensuring that there
>> is only one possible interpretation of the equality semantics for the
>> foreign key.

> I've attached a patch which disallows these, though I was not quite sure
> about the new error message since likely this is something that should be
> backpacked? I wasn't sure on the policy for new translations in a minor
> release.

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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-08-09 03:54:03 Re: Defining a foreign key with a duplicate column is broken
Previous Message David Rowley 2014-08-09 03:00:32 Re: Defining a foreign key with a duplicate column is broken