Re: check constraint bug?

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Tarlika Elisabeth Schmitz <postgresql3(at)numerixtechnology(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: check constraint bug?
Date: 2011-05-06 05:10:19
Message-ID: BANLkTimt7GMbEgkRtLvKFy+kK8KDOnn2Og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, May 5, 2011 at 11:06 PM, Tarlika Elisabeth Schmitz
<postgresql3(at)numerixtechnology(dot)de> wrote:
> I specified:
>
> ALTER TABLE h ADD CONSTRAINT val_h_stats
> CHECK (NOT (sex = 'f') AND (stats IS NOT NULL));
>
> which was translated to:
>
> ALTER TABLE h ADD CONSTRAINT val_h_stats
> CHECK (NOT sex = 'f'::bpchar AND stats IS NOT NULL);

You need another level of parens:

CHECK (NOT ((sex = 'f') AND (stats IS NOT NULL)));

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Claudio Adriano Guarracino 2011-05-06 05:41:36 Re: Select and merge rows?
Previous Message Tarlika Elisabeth Schmitz 2011-05-06 05:06:08 check constraint bug?