Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group