Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-bugs by date

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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group