Re: Subselects in CHECK clause ...

From: James Robinson <jlrobins(at)socialserve(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Subselects in CHECK clause ...
Date: 2006-11-29 17:59:50
Message-ID: 2F743829-2490-4D62-932C-3AD163AEE53A@socialserve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gotcha. This is indeed to ensure a specialized ref integrity bit,
against a column which "ought not ever change". Once some more old
code goes away, then can fully normalize this area, making this check
subselect bit go away, replaced by a regular FK.

Hmm -- probably could even now make it a FK against a column which is
not the pri key of the foreign table, and it'd work better and would
ensure consistence against changes on the foreign table side, eh?

Thanks!

On Nov 29, 2006, at 12:53 PM, Stephan Szabo wrote:

> To completely get the constraint, you have to also apply
> constraints on
> the tables referenced in the function that prevent modifications on
> those
> tables from causing the constraint to be violated. For example, if you
> were to do an exists test on another table for a row that matches
> up with
> this row in some fashion (for a specialized referential integrity
> constraint) modifications on that other table could also cause the
> constraint to be violated, but that isn't caught by the CHECK
> function(...) case and you'll probably need triggers or other
> constraints
> on that table.

----
James Robinson
Socialserve.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ehab Galal 2006-11-30 00:41:42 SQL command join question
Previous Message Stephan Szabo 2006-11-29 17:53:16 Re: Subselects in CHECK clause ...