pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ldrlj1 <russelljanusz@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: table constraint on two columns
Date: Mon, 22 Jul 2013 07:05:21 -0700 (PDT)
Message-ID: <1374501921767-5764645.post@n5.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Postgres 9.2.4.

I have two columns, approved and comments. Approved is a boolean with no
default value and comments is a character varying (255) and nullable.

I am trying to create a constraint that will not allow a row to be entered
if approved is set to false and comments is null.

This does not work. yada, yada, yada... add constraint "chk_comments' check
(approved = false and comments is not null). The constraint is successfully
added, but does not work as I expected.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/table-constraint-on-two-columns-tp5764645.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <1374501921767-5764645.post@n5.nabble.com>
Permalink:  ../1374501921767-5764645.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1374501921767-5764645.post@n5.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: russelljanusz@yahoo.com
  Subject: Re: table constraint on two columns
  In-Reply-To: <1374501921767-5764645.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox