Re: multi column foreign key for implicitly unique columns

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Huxton <dev(at)archonet(dot)com>, Markus Bertheau <twanger(at)bluetwanger(dot)de>, Josh Berkus <josh(at)agliodbs(dot)com>, olly(at)lfix(dot)co(dot)uk, pgsql-sql(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: multi column foreign key for implicitly unique columns
Date: 2004-08-18 16:27:40
Message-ID: 4123837C.30408@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/18/2004 12:18 PM, Tom Lane wrote:

> Richard Huxton <dev(at)archonet(dot)com> writes:
>> * Allow multiple unique constraints to share an index where one is a
>> superset of the others' columns.
>
>> That way you can mark it unique without having the overhead of multiple
>> indexes.
>
> That just moves the uncertain-dependency problem over one spot, ie, it's
> the fabricated unique constraint that you can't pin down the
> requirements for.

If we allow for a unique index, that

* it is NOT maintained (no index tuples in there)
* depends on another index that has a subset of columns
* if that subset-index is dropped, the index becomes maintained

then the uncertainty is gone. At the time someone drops the other
constraint or unique index, the data is unique with respect to the
superset of columns. So building the unique index data at that time will
succeed.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2004-08-18 16:46:14 Re: multi column foreign key for implicitly unique columns
Previous Message Tom Lane 2004-08-18 16:18:37 Re: multi column foreign key for implicitly unique columns