Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D20151337BC4 for ; Fri, 6 May 2011 02:10:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 46848-06 for ; Fri, 6 May 2011 05:10:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ey0-f174.google.com (mail-ey0-f174.google.com [209.85.215.174]) by mail.postgresql.org (Postfix) with ESMTP id 664681337BB4 for ; Fri, 6 May 2011 02:10:20 -0300 (ADT) Received: by eyx24 with SMTP id 24so865734eyx.19 for ; Thu, 05 May 2011 22:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=bbGAsSB9dePb2H8yGsT4jRmF0ai522GOJmX6W6ODOVg=; b=hq9fPxIfrnZcHzWPCX0Tq6Vrek8eVnHNszcPErTyHlGby7LOu2hS9rXK0JXZ+vdi8u TjZcf6y6c4LYgTzBHZBB2x1RdKepnGlgVhWoSMfxLggdUtabU3UvvzvVvaT90mDESbgR SXvZIXVHX4MKY3zz4yfZY6RPVNbE5Wk4TVOPs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=RRxGwZLK3JTAHJWnAzoosBicOd+vbCcVA8aUkgWi4I2RZB9PyWXH0NgrKrYt6kakkF KGAfNxWfsiXeijudjPiUNrA/318d5y+kIhHhoK+X/t2tFsxhtuTDpELokEPjViJAmJ7A 0er4XWAgWVON5VdHySHCXG8VlTP/TbhTxyZTA= MIME-Version: 1.0 Received: by 10.213.98.201 with SMTP id r9mr656867ebn.42.1304658619094; Thu, 05 May 2011 22:10:19 -0700 (PDT) Received: by 10.213.9.81 with HTTP; Thu, 5 May 2011 22:10:19 -0700 (PDT) In-Reply-To: <20110506060608.12bd24b0@dick.coachhouse> References: <20110506060608.12bd24b0@dick.coachhouse> Date: Thu, 5 May 2011 23:10:19 -0600 Message-ID: Subject: Re: check constraint bug? From: Scott Marlowe To: Tarlika Elisabeth Schmitz Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/33 X-Sequence-Number: 35317 On Thu, May 5, 2011 at 11:06 PM, Tarlika Elisabeth Schmitz 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)));