X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 33D3F476033 for ; Tue, 25 Feb 2003 04:43:06 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 49213-09 for ; Tue, 25 Feb 2003 04:42:55 -0500 (EST) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by postgresql.org (Postfix) with ESMTP id 7BD7C476069 for ; Tue, 25 Feb 2003 00:46:27 -0500 (EST) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/100.1) with ESMTP id QAA27434 for ; Tue, 25 Feb 2003 16:39:29 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3E5B03B9.4070500@oasis.net.au> Date: Tue, 25 Feb 2003 15:48:41 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Sub Select inside Check ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/541 X-Sequence-Number: 11939 Hi, I'm trying to create this table with a Check that fails. I'm using 'Check' instead of 'References' due to poor db schema ( before me .. ) Here is my error message: ERROR: cannot use subselect in CHECK constraint expression CREATE TABLE cp_retailers ( ret_id serial PRIMARY KEY, ret_name varchar(120) NOT NULL, ret_address1 varchar(120), ret_address2 varchar(120), sub_id integer NOT NULL CHECK ( EXISTS ( SELECT sub_id FROM suburbs ) ) ); I guess that say's it all - no sub select's in Check or am I on the wrong track ? Thank you kindly Regards Rudi.