> -----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