constraint problem

Поиск
Список
Период
Сортировка
От Martín Marqués
Тема constraint problem
Дата
Msg-id 200507252028.32501.martin@bugs.unl.edu.ar
обсуждение исходный текст
Ответы Re: constraint problem  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: constraint problem  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
I have a table with a login, password and confirmed columns (besides others),
and I'm having so trouble getting this contraint to work.

The account is created with login and password NULL and confirmed set to
false. Once the user gives the app he's login and password (login is unique)
the system updates that row with the new login, password and sets confirmed
to true.

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?

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués          |   Programador, DBA
Centro de Telemática    |     Administrador
               Universidad Nacional
                    del Litoral
---------------------------------------------------------

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: pgsql client/server compatibility matrix?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: constraint problem