Re: Foreign key column reference ordering and information_schema

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Foreign key column reference ordering and information_schema
Date: 2006-05-17 16:05:27
Message-ID: 20680.1147881927@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> On Wed, 17 May 2006, Tom Lane wrote:
>> where SQL2003 has
>>
>> If the <referenced table and columns> specifies a <reference column
>> list>, then there shall be a one-to-one correspondence between the
>> set of <column name>s contained in that <reference column list>
>> and the set of <column name>s contained in the <unique column
>> list> of a unique constraint of the referenced table such that
>> corresponding <column name>s are equivalent. Let referenced columns
>> be the column or columns identified by that <reference column
>> list> and let referenced column be one such column. Each referenced
>> column shall identify a column of the referenced table and the same
>> column shall not be identified more than once.
>>
>> I think SQL2003 is actually just trying to say the same thing in more
>> precise language: you have to be able to match up the columns in the
>> <reference list> with some unique constraint. I don't think the "one
>> to one" bit is meant to imply a left-to-right-ordered correspondence;
>> that's certainly not the mathematical meaning of a one-to-one function
>> for instance.

> No, but the part which says corresponding column names are equivalent
> seems to imply it to me.

No, that's just saying the names have to actually match. Otherwise I
could say that I can put "A B C" into a one-to-one correspondence with
"D E F" because there are the same number of elements in each set.
The whole sentence was written by a pedant and is not an improvement in
intelligibility over the SQL92/99 wording, but I really think it is not
intended to imply anything functionally different. Again, if they did
intend to change the allowable matches, why doesn't Annex E mention it?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-17 16:08:07 Re: Foreign key column reference ordering and information_schema
Previous Message Stephan Szabo 2006-05-17 16:00:28 Re: Foreign key column reference ordering and information_schema