Re: WIP: generalized index constraints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WIP: generalized index constraints
Date
Msg-id 6346.1253397645@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP: generalized index constraints  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: WIP: generalized index constraints
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> On Sat, 2009-09-19 at 16:43 -0400, Tom Lane wrote:
>> I don't understand why this isn't handled exactly the way unique
>> constraints are done now.  Frankly, the amount of added complexity you
>> propose below is enough to make me want to reject the patch forthwith;
>> given that it's going to be a relatively little-used feature, the bugs
>> are never going to be out of it completely if we do it like this.

> Unique constraints lock the index page while the insert is happening.
> How am I supposed to do that, when the conflicting values might be
> anywhere in the index (circles have no total order)?

Well, you can't do it *exactly* the same way btree does, but what
I would envision is first insert the index tuple and then do a
dirty-snapshot search for conflicting tuples.  The interlock against
conflicting concurrent inserts doesn't need all this new infrastructure
you propose; just wait to see if conflicting transactions commit, same
as we do now.  And I do maintain that that sort of code has a high risk
of undetected bugs.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: generic copy options
Next
From: Tom Lane
Date:
Subject: Re: operator exclusion constraints [was: generalized index constraints]