Can I use check-constraint to set null?

Поиск
Список
Период
Сортировка
От Rikard Bosnjakovic
Тема Can I use check-constraint to set null?
Дата
Msg-id AANLkTik6wgxKakmQz1-Lx_0EJC41oydbfuubWhywrk03@mail.gmail.com
обсуждение исходный текст
Ответы Re: Can I use check-constraint to set null?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Can I use check-constraint to set null?  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-novice
(Postgres 8.4.2)

CREATE TABLE test (foo numeric(8,2) CHECK (foo >= 0.0));

ecdb=> insert into test values (-2.2);
ERROR:  new row for relation "test" violates check constraint "test_foo_check"

This is expected.

However, is there a way to insert a null when this check fails,
instead of returning an error (and thus aborting the insert)? I'm
reading on http://www.postgresql.org/docs/current/static/ddl-constraints.html
but cannot find an answer to this question.


--
- Rikard

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

Предыдущее
От: Kavitha Parvataneni
Дата:
Сообщение: Remote Connection to server: Connection Refused
Следующее
От: Victor Hugo
Дата:
Сообщение: Re: Remote Connection to server: Connection Refused