Helge Bahmann <bahmann@math.tu-freiberg.de> writes:
> CREATE TABLE ex2(name text, CHECK (name in (SELECT name FROM ex1)));
> ERROR: ExecEvalExpr: unknown expression type 108
I don't believe the constraint code knows how to cope with constraint
expressions that require planning :-(.
If you want to become a backend programming guru, a good path to
enlightenment would be to figure out how to fix that without
unacceptable performance penalties.
If you don't, I'd suggest embedding the SELECT in a plpgsql function.
regards, tom lane