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

From Tom Lane
Subject Re: Problem with subquery in CHECK constraint.
Date
Msg-id 3912.960392918@sss.pgh.pa.us
Whole thread Raw
In response to Problem with subquery in CHECK constraint.  (Niall Smart <niall.smart@ebeon.com>)
Responses RE: Problem with subquery in CHECK constraint.  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-sql
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.

For now I'd suggest putting the subquery into an SQL or plpgsql function
that you invoke from the constraint expression.
        regards, tom lane


pgsql-sql by date:

Previous
From: Ed Loehr
Date:
Subject: Re: oracle rownum equivalent?
Next
From: "Steffers"
Date:
Subject: ...