Re: strange behaviour of "CHECK ... IN (SELECT ...)" as constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Helge Bahmann <bahmann(at)math(dot)tu-freiberg(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: strange behaviour of "CHECK ... IN (SELECT ...)" as constraint
Date: 2000-07-20 05:30:29
Message-ID: 23533.964071029@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Helge Bahmann <bahmann(at)math(dot)tu-freiberg(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Boszormenyi Laszlo 2000-07-20 10:54:22 Get a row by it's number
Previous Message Helge Bahmann 2000-07-19 21:55:55 strange behaviour of "CHECK ... IN (SELECT ...)" as constraint