Re: constraint problem

From: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: constraint problem
Date: 2005-07-26 10:33:55
Message-ID: 200507260733.56910.martin@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El Lun 25 Jul 2005 23:29, Stephan Szabo escribió:
> >
> > Now to the constraint:
> >
> > I don't want the login and password columns to have nulls when the account
> > (row) is confirmed (confirmed column is set to true).
> >
> > I tried adding this CONSTRAINT to the table definition, but with no luck:
> >
> > CONSTRAINT nonuloconfirmado CHECK
> > ((login NOT NULL AND password NOT NULL) OR NOT confirmado)
> >
> > It gives an error on the first NULL.
> >
> > How can this be solved?
>
> I think you'd want
> (login IS NOT NULL AND password IS NOT NULL) OR NOT confirmado

<banning my head to the wall>
HOW COULD I HAVE MISSED THAT!!!
</banning my head to the wall>

I feel so stupid today. :-(

--
07:31:18 up 23 days, 16:16, 1 user, load average: 1.09, 0.96, 0.74
-------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' ||
Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
-------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Riyad Aufari 2005-07-26 10:46:52 Error when entering template1
Previous Message Philippe Lang 2005-07-26 06:57:42 Trigger disactivation and SELECT WAITING