Re: BUG #4888: Removed brackets from Check Constraints expressions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "stalker" <chimera(at)bk(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4888: Removed brackets from Check Constraints expressions
Date: 2009-06-26 16:09:31
Message-ID: 7913.1246032571@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"stalker" <chimera(at)bk(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-06-26 16:13:39 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Previous Message Alvaro Herrera 2009-06-26 15:57:51 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode