Re: BUG #4888: Removed brackets from Check Constraints expressions - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4888: Removed brackets from Check Constraints expressions
Date
Msg-id 7913.1246032571@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4888: Removed brackets from Check Constraints expressions  ("stalker" <chimera@bk.ru>)
List pgsql-bugs
"stalker" <chimera@bk.ru> writes:
> I try to create Check Constraints for DB with Nested Set data model. When I
> write complex validation rule with OR-operator - result Description is
> incorrect.

> ALTER TABLE Catalog
>   ADD CONSTRAINT ctg_check_ns CHECK (id_lft > id_rgt OR (id_lft = 0 AND
> id_lft = 0));

> Result:
>   'ctg_check_ns' Definition == "id_lft > id_rgt OR id_lft = 0 AND id_lft =
> 0".

Looks perfectly correct to me.  AND binds more tightly than OR.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode