| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | ilussier(at)accovia(dot)com |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #9820: Parentheses removed in chech constraint |
| Date: | 2014-04-01 18:41:01 |
| Message-ID: | 24144.1396377661@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
ilussier(at)accovia(dot)com writes:
> 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.
Sure it does. AND binds more tightly than OR.
You did not state what your actual problem is, but whether or not the
constraint-printer adds logically redundant parentheses isn't it...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kjetil Nygård | 2014-04-01 20:18:34 | Timezone error when casting. Maybe daylight saving |
| Previous Message | Mike Blackwell | 2014-04-01 15:26:10 | Re: BUG #9518: temporary login failure - "missing pg_hba entry" |