Search Postgresql Archives

Re: foreign key restrictions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Richard Broersma" <richard.broersma@xxxxxxxxx> writes:

> On Sun, Aug 10, 2008 at 1:15 AM,  <rafal@xxxxxxxxxxxxxxxxxx> wrote:
>
>> Since table TWO has a unique constraint on column ID, the (ID, OFONE) pair
>> will also be unique, obviously.
>
> This statement is not completely true.  The only part of the pair that
> is true is ID.  Also there is not unique constraint on the pare.  So
> there is no way to PG to build a foreing key on the pair.

Uhm, afaics he's right. if ID is unique not null then <ID, OFONE> also has to
be unique. That is, there could be duplicate values of OFONE but they'll all
have different values of ID anyways.

I'm not sure if there's a fundamental reason why there has to be an index that
exactly matches the foreign key or not -- offhand I can't think of one.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux