The following bug has been logged online:
Bug reference: 4888
Logged by: stalker
Email address: chimera@bk.ru
PostgreSQL version: 8.3.7
Operating system: Debian 4.0 (etch)
Description: Removed brackets from Check Constraints expressions
Details:
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.
CREATE TABLE Catalog
(
id integer,
id_lft integer, -- nested set
id_rgt integer,
);
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".