Re: subquery in CHECK constraint - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: subquery in CHECK constraint
Date
Msg-id 20140719.133223.1940636279314065748.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: subquery in CHECK constraint  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
> I think the basic problem would be what the check constraint subquery
> meant to the user, and how useful that is expected to be in general. A
> subquery in a check constraint would presumably involve checking the
> subquery using an existing snapshot of the command that required the
> constraint to be verified (say, an INSERT). But why should that
> snapshot be so special? In any case the result of the subquery may not
> be immutable (even in some limited, practical sense), and we expect
> check constraints to be on immutable conditions on constrained columns
> only. In general it would be practically impossible to determine that
> something else had changed the state of the database in such a way as
> to make the check constraint no longer verify successfully on each
> row, so we would not be able to prevent that from happening later on.
> 
> I imagine that you have a very specific case in mind, though. Perhaps
> you can share the details.

No I don't have a specific case. I am just wondering because it's
defined in the standard.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: subquery in CHECK constraint
Next
From: "MauMau"
Date:
Subject: Re: [bug fix] Suppress "autovacuum: found orphan temp table" message