From: Tomasz Myrta <jasiek@klaster.net>
To: Rudi Starcevic <rudi@oasis.net.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sub Select inside Check ?
Date: Tue, 25 Feb 2003 12:29:49 +0100
Message-ID: <3E5B53AD.8050406@klaster.net> (raw)
References: <3E5B03B9.4070500@oasis.net.au>
Rudi Starcevic wrote:
> 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 ?
Postgresql 7.3 documentation:
"SQL Commands/CREATE TABLE":
...Currently, CHECK expressions cannot contain subselects nor refer to
variables other than columns of the current row...
Regards,
Tomasz Myrta
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: jasiek@klaster.net, rudi@oasis.net.au
Subject: Re: Sub Select inside Check ?
In-Reply-To: <3E5B53AD.8050406@klaster.net>
* 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