Re: Deferrable Unique Constraints - Mailing list pgsql-hackers

From Neil Conway
Subject Re: Deferrable Unique Constraints
Date
Msg-id 1106800289.3226.47.camel@localhost.localdomain
Whole thread Raw
In response to Re: Deferrable Unique Constraints  (Greg Stark <gsstark@mit.edu>)
Responses Re: Deferrable Unique Constraints
Re: Deferrable Unique Constraints
List pgsql-hackers
On Wed, 2005-01-26 at 15:48 -0500, Greg Stark wrote:
> Well presumably you would need a non-unique index created for query execution
> purposes. The unique index would be purely for enforcing the constraint.

Yuck.

You could perhaps relax the uniqueness of the index during the
transaction itself, and keep around some backend-local indication of
which index entries it have been inserted. Then at transaction-commit
you'd need to re-check the inserted index entries to verify that they
are unique. It would be nice to just keep a pin on the leaf page that we
inserted into, although we'd need to take care to follow subsequent page
splits (could we use the existing L & Y techniques to do this?).
Needless to say, it would be pretty ugly...

-Neil




pgsql-hackers by date:

Previous
From: Tim Allen
Date:
Subject: Re: Patent issues and 8.1
Next
From: Tom Lane
Date:
Subject: Re: Deferrable Unique Constraints