RE: Problem with subquery in CHECK constraint.

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Niall Smart" <niall(dot)smart(at)ebeon(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Problem with subquery in CHECK constraint.
Date: 2000-06-08 18:01:50
Message-ID: EKEJJICOHDIEMGPNIFIJGEJMCBAA.Inoue@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> -----Original Message-----
> From: pgsql-sql-owner(at)hub(dot)org [mailto:pgsql-sql-owner(at)hub(dot)org]On
> Behalf Of Niall Smart
>
>
> CONSTRAINT TYPE_CD_OK CHECK (
> EXISTS (SELECT 1 FROM XREF WHERE
> XREF_GROUP = 'CUST_TYPE' AND
> XREF_CD = TYPE_CD)
> )
>
>
> > There seems to be more serious problems.
> > 1) The constraint is not only for the defined table but also
> for referenced
> > tables in the subquery.
>
> I don't understand what you mean -- the constraint only
> constrains 1 column in one table...
>

Doesn't the constraint mean that
for any row in table CUST,there *always* exist some rows in
the table XREF such that satisfies XREF_GROUP='CUST_TYPE'
AND XREF_CD=TYPE_CD ?
If all such rows are deleted from the table XREF,above condition
isn't satisfied any longer. So isn't the constraint for the table XREF
either ?

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2000-06-08 18:15:08 Re: Problem with subquery in CHECK constraint.
Previous Message Michael J Schout 2000-06-08 17:49:10 trigger/refint question..