pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rudi Starcevic <rudi@oasis.net.au>
To: pgsql-sql@postgresql.org
Subject: Sub Select inside Check ?
Date: Tue, 25 Feb 2003 15:48:41 +1000
Message-ID: <3E5B03B9.4070500@oasis.net.au> (raw)

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.




view thread (3+ messages)  latest in thread

Message-ID: <3E5B03B9.4070500@oasis.net.au>
Permalink:  ../3E5B03B9.4070500@oasis.net.au/
Also on:    postgresql.org/message-id/3E5B03B9.4070500@oasis.net.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rudi@oasis.net.au
  Subject: Re: Sub Select inside Check ?
  In-Reply-To: <3E5B03B9.4070500@oasis.net.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox