RE: Problem with subquery in CHECK constraint. - Mailing list pgsql-sql

From Hiroshi Inoue
Subject RE: Problem with subquery in CHECK constraint.
Date
Msg-id 000901bfd0df$f57c1f20$2801007e@tpf.co.jp
Whole thread Raw
In response to Re: Problem with subquery in CHECK constraint.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
> -----Original Message-----
> From: pgsql-sql-owner@hub.org [mailto:pgsql-sql-owner@hub.org]On Behalf
> Of Tom Lane
> 
> Niall Smart <niall.smart@ebeon.com> writes:
> > However when trying to insert into CUST I get the following error:
> >         ERROR:  ExecEvalExpr: unknown expression type 108
> > Is this a bug in PostGreSQL?
> 
> Yup.  Looks like the subquery is not getting expanded into a subplan.
> Could be a little messy to fix, unless we redo the planning on every
> execution of the check constraint ... which doesn't sound appetizing.
>

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.
2) There should be some standard lock mechanism for the range restricted   by the subquery. 

I'm suspicious that we should/could implement constraints other than 
column constraints.   

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp


pgsql-sql by date:

Previous
From: Bernie Huang
Date:
Subject: Fetch an element in an array
Next
From: Bruce Momjian
Date:
Subject: Re: counting distinct values