Re: operator exclusion constraints [was: generalized index constraints] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: operator exclusion constraints [was: generalized index constraints]
Date
Msg-id 27088.1253483698@sss.pgh.pa.us
Whole thread Raw
In response to operator exclusion constraints [was: generalized index constraints]  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: operator exclusion constraints [was: generalized index constraints]
Re: operator exclusion constraints [was: generalized index constraints]
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> 1. Constraint syntax, part of CREATE/ALTER TABLE:

>   [CONSTRAINT <name>] EXCLUSION (<expr> OPERATOR <op>, ...)

Have you actually built this grammar?  I don't think it avoids the
problem, because OPERATOR is possible within a_expr.

Also, don't forget the possibility of wanting a nondefault opclass.
(I'm wondering a bit if anyone will want a WHERE clause, too, though
adding that later shouldn't pose any big syntactic obstacles.)

> Brendan made a strong argument[15] that the behavior of LIKE
> with UNIQUE is wrong, but I don't know if we want to try to fix that
> now. I'd like some more input before I actually take care of this item.

That's really a separate issue, but I think we need to do something to
make it more consistent.  My first thought is that anything made
via CONSTRAINT syntax ought to be copied by LIKE INCLUDING CONSTRAINTS,
while LIKE INCLUDING INDEXES should copy anything you made via CREATE
INDEX.  But note this assumes that there is a clear distinction between
the two.  The constraint-depending-on-index design that you started
with would not permit such a rule, or at least it would mean that
INCLUDING CONSTRAINTS EXCLUDING INDEXES would have failure cases.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: operator exclusion constraints [was: generalized index constraints]
Next
From: Robert Haas
Date:
Subject: Re: generic copy options