Niall Smart <[EMAIL PROTECTED]> writes:
> However when trying to insert into CUST I get the following error:
> ERROR: ExecEvalExpr: unknown expression type 108
> Is this a bug in PostGreSQL?
Yup. Looks like the subquery is not getting expanded into a subplan.
Could be a little messy to fix, unless we redo the planning on every
execution of the check constraint ... which doesn't sound appetizing.
For now I'd suggest putting the subquery into an SQL or plpgsql function
that you invoke from the constraint expression.
regards, tom lane