Re: BUG #11705: \d(escribe) table shows incorrect check constraint

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "finkel(at)sd-il(dot)com" <finkel(at)sd-il(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #11705: \d(escribe) table shows incorrect check constraint
Date: 2014-10-20 20:44:22
Message-ID: 1413837862.43723.YahooMailNeo@web122301.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"finkel(at)sd-il(dot)com" <finkel(at)sd-il(dot)com> wrote:
> We have a table with this constraint:

>
> CONSTRAINT check_m_nullability CHECK (((m1 IS NULL) AND
> (m2 IS NULL)) OR ((m1 IS NOT NULL) AND (m2 IS NOT NULL)))

Michael is right, but in addition to that you might want to use the
simpler (and to my eye easier to read):

CONSTRAINT check_m_nullability CHECK ((m1 IS NULL) = (m2 IS NULL))

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2014-10-20 22:01:50 Re: BUG #10675: alter database set tablespace and unlogged table
Previous Message Tom Lane 2014-10-20 16:24:48 Re: BUG #11703: ERROR: variable not found in subplan target list