Re: [BUGS] No subselects in constraint (bug?) - Mailing list pgsql-sql

From Tom Lane
Subject Re: [BUGS] No subselects in constraint (bug?)
Date
Msg-id 17821.995050827@sss.pgh.pa.us
Whole thread Raw
List pgsql-sql
"Alexey V. Neyman" <avn@any.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


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: [BUGS] No subselects in constraint (bug?)
Next
From: "Josh Berkus"
Date:
Subject: Re: You have an error in your SQL syntax near '' at line 1