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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:00:32
Message-ID: CAApHDvq=Sck4UMz2oGTN7RPQ00N4DjOfQTy7+uig18Yave232A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

The wording of the comment above the code which disallows the duplicate
column references could likely do with some meaningful explanation about
the reasons why we disallow these, I thought your words would be a bit
better at doing this so I didn't try very hard on that part.

Is this roughly what you had in mind?

Regards

David Rowley

Attachment Content-Type Size
transformFkeyCheckAttrs_fix_v2.patch application/octet-stream 3.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-08-09 03:34:30 Re: Defining a foreign key with a duplicate column is broken
Previous Message Bruce Momjian 2014-08-09 02:47:37 Re: jsonb format is pessimal for toast compression