Re: strange behaviour of "CHECK ... IN (SELECT ...)" as constraint - Mailing list pgsql-novice

From Tom Lane
Subject Re: strange behaviour of "CHECK ... IN (SELECT ...)" as constraint
Date
Msg-id 23533.964071029@sss.pgh.pa.us
Whole thread Raw
In response to strange behaviour of "CHECK ... IN (SELECT ...)" as constraint  (Helge Bahmann <bahmann@math.tu-freiberg.de>)
List pgsql-novice
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

pgsql-novice by date:

Previous
From: Helge Bahmann
Date:
Subject: strange behaviour of "CHECK ... IN (SELECT ...)" as constraint
Next
From: Boszormenyi Laszlo
Date:
Subject: Get a row by it's number