Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6DJ13a26978; Fri, 13 Jul 2001 15:01:03 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6DJ0RX17824; Fri, 13 Jul 2001 15:00:27 -0400 (EDT) To: "Alexey V. Neyman" cc: pgsql-sql@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: No subselects in constraint (bug?) In-reply-to: <20010713135728.U2566-100000@srv2.any> References: <20010713135728.U2566-100000@srv2.any> Comments: In-reply-to "Alexey V. Neyman" message dated "Fri, 13 Jul 2001 14:16:23 +0400" Date: Fri, 13 Jul 2001 15:00:27 -0400 Message-ID: <17821.995050827@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/67 X-Sequence-Number: 1849 "Alexey V. Neyman" 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