Re: Re: how to implement a foreign key type constraint against a not unique column

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: how to implement a foreign key type constraint against a not unique column
Date: 2009-01-27 18:22:32
Message-ID: 51DA7A20-4D7B-4351-AD01-C48A322BBE8C@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jan 25, 2009, at 3:07 AM, Jasen Betts wrote:

>> I want to use this column as a foreign key on a column in another
>> table
>> (column 2), but cannot without a full unique index.
>
> a full unique index is easy use an expression that's null for -1.
>
> create unique index foobar on foo( ( case fee when -1 then null else
> fee end ) );

anything wrong with create unique index foobar on foo where fee <> -1 ?

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.

!DSPAM:737,497f50e9747031810420427!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message justin 2009-01-27 18:25:16 Re: performance advice needed: join vs explicit subselect
Previous Message Jeff Davis 2009-01-27 18:13:32 Re: New 8.4 hot standby feature