pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexey V. Neyman <avn@any.ru>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-bugs@postgresql.org
Subject: Re: No subselects in constraint (bug?)
Date: Fri, 13 Jul 2001 15:00:27 -0400
Message-ID: <17821.995050827@sss.pgh.pa.us> (raw)
In-Reply-To: <20010713135728.U2566-100000@srv2.any>
References: <20010713135728.U2566-100000@srv2.any>

"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



view thread (3+ messages)

Message-ID: <17821.995050827@sss.pgh.pa.us>
Permalink:  ../17821.995050827@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17821.995050827@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, avn@any.ru, pgsql-bugs@postgresql.org
  Subject: Re: No subselects in constraint (bug?)
  In-Reply-To: <17821.995050827@sss.pgh.pa.us>

* 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