Re: No subselects in constraint (bug?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alexey V(dot) Neyman" <avn(at)any(dot)ru>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: No subselects in constraint (bug?)
Date: 2001-07-13 19:00:27
Message-ID: 17821.995050827@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

"Alexey V. Neyman" <avn(at)any(dot)ru> writes:
> CREATE TABLE b (
> int4 id
> CHECK (id = ANY(SELECT a.id FROM a))
> );

> ERROR: ExecEvalExpr: unknown expression type 108

More recent versions say

ERROR: Cannot use subselect in CHECK clause

It seems to me that what you really want here is a foreign key
reference, anyway, not a handmade CHECK constraint.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Darko Prenosil 2001-07-13 23:13:33 pgsql
Previous Message Peter Eisentraut 2001-07-13 18:29:39 Re: bug report: tuple is too big

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-07-13 19:01:16 Re: You have an error in your SQL syntax near '' at line 1
Previous Message Joe Conway 2001-07-13 18:57:19 Re: How can we match a condition among 2 diff. tables?