Re: Is this a bug in the table definition or in PostgreSQL? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Is this a bug in the table definition or in PostgreSQL?
Date
Msg-id 24209.957462132@sss.pgh.pa.us
Whole thread Raw
In response to Is this a bug in the table definition or in PostgreSQL?  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-hackers
"Oliver Elphick" <olly@lfix.co.uk> writes:
> The complicated constraint in this definition of the product table doesn't
> work, but should it?  or is there a better way to do this?
>    ...
>    CONSTRAINT ean CHECK (
>          CASE WHEN eancode IS NULL OR brand IS NULL
>                    THEN 't'
>                    ELSE ean_checkdigit(
>                        (SELECT ean_prefix
>                           FROM brandname
>                           WHERE brandname.id = brand
>                        ), eancode)
>          END
>       )

> copy product from '/rover/avoca/dumps/dbdump.product'
> ERROR:  copy: line 2, ExecEvalExpr: unknown expression type 108
> [line 1 had null values in the relevant fields]

108 ... (checks nodes.h) ... SubLink ... looks like your sub-select
isn't getting processed properly.  I'd say it's a bug, but it's
probably too late to fix it for 7.0.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.0RC2 compile error !
Next
From: Tom Lane
Date:
Subject: Re: pg_group_name_index corrupt?