Ian Turner <[EMAIL PROTECTED]> writes:
> Uhhh. I get no errors, but it dosen't work, either. Consider:
I didn't say that you would like the semantics ;-).
The check constraint is going to be evaluated *before* the proposed
new tuple is inserted into the table, not after; so doing a select
on the same table won't see the new tuple.
Also, as several other people already pointed out, a constraint
involving a select could be violated in many ways including alteration
or removal of tuples in other tables. We only evaluate check
constraints when we insert/update tuples in the table they are attached
to...
regards, tom lane