Re: BUG #11705: \d(escribe) table shows incorrect check constraint - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #11705: \d(escribe) table shows incorrect check constraint
Date
Msg-id 1413837862.43723.YahooMailNeo@web122301.mail.ne1.yahoo.com
Whole thread Raw
In response to BUG #11705: \d(escribe) table shows incorrect check constraint  (finkel@sd-il.com)
List pgsql-bugs
"finkel@sd-il.com" <finkel@sd-il.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #11703: ERROR: variable not found in subplan target list
Next
From: Andres Freund
Date:
Subject: Re: BUG #10675: alter database set tablespace and unlogged table