From: | ilussier(at)accovia(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #9820: Parentheses removed in chech constraint |
Date: | 2014-04-01 15:01:57 |
Message-ID: | 20140401150157.363.83570@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 9820
Logged by: Isabelle Lussier
Email address: ilussier(at)accovia(dot)com
PostgreSQL version: 9.3.2
Operating system: Windows (PgAdmin)
Description:
Hi, I'am want to add a check constraint that checks if the first condition
is true OR the second condition is true. If one of the two conditions is
true, then the check is true.
Example:
alter table table_name add constraint c1 CHECK ( (type = 0 AND field1 IS NOT
NULL AND field2 IS NOT NULL AND field3 IS NOT NULL) OR (type_id = 1 AND
field1 IS NULL AND field2 IS NULL AND field3 IS NULL) )
At the execution of the query, the parentheses that defines condition 1 and
condition 2 are removed. By removing the parentheses, the expression does
not means the same thing. Why postgresql removes the parentheses or how can
I do the constraint differently?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-04-01 15:13:30 | Re: BUG #9518: temporary login failure - "missing pg_hba entry" |
Previous Message | jan.sarenik | 2014-04-01 14:19:07 | BUG #9818: LDAP Authentication subtree problem |