Re: subqueries in check - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: subqueries in check
Date
Msg-id 20050109161457.GE4194@dcc.uchile.cl
Whole thread Raw
In response to subqueries in check  (Jaime Casanova <systemguards@yahoo.com>)
List pgsql-hackers
On Fri, Jan 07, 2005 at 11:06:58PM -0600, Jaime Casanova wrote:

Jaime,

> i was looking at the unsuported features in the RC4
> docs and found this:
> 
> F671| Enhanced integrity management| Subqueries in CHECK| intentionally omitted 
> 
> Why is it *intentionally omitted*?
> Is it to hard? or has some side-effects?

Because it's too expensive to check.  If you have a CHECK using a SELECT
against a second table, you should re-verify the SELECT every time the
second table suffers an UPDATE, INSERT or DELETE.

The user can replace the CHECK with a foreign key or a trigger, so there
is no loss of functionality.

-- 
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"No single strategy is always right (Unless the boss says so)"                                                 (Larry
Wall)


pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Home dir changes have broken MSVC builds
Next
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4