Re: DEFERRABLE NOT NULL constraint

Поиск
Список
Период
Сортировка
От Bèrto ëd Sèra
Тема Re: DEFERRABLE NOT NULL constraint
Дата
Msg-id CAKwGa_9E-_PDDXQ9gm13S-unN58-r+VEkV8QEB9SibLx6VzeOA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: DEFERRABLE NOT NULL constraint  (Chris Angelico <rosuav@gmail.com>)
Ответы Re: DEFERRABLE NOT NULL constraint  (Chris Angelico <rosuav@gmail.com>)
Re: DEFERRABLE NOT NULL constraint  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
Hi Chris,

> I don't see
> any reason to create a record with a NULL and then replace that NULL
> before committing. Sort out program logic first; then look to the
> database.

I beg to differ here. Say you have a set of business rules that
rigidly defines how that field must be made AND the data on which it
is based is not visible to the user who does the insert. At this point
you need "something" to generate that value on the fly for the user
(calling a procedure from a before insert trigger). You still need
your field to be NOT NULL, though. Because it happens to be... the PK
:)

Cheers
Bèrto

--
==============================
If Pac-Man had affected us as kids, we'd all be running around in a
darkened room munching pills and listening to repetitive music.



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

Предыдущее
От: Chris Angelico
Дата:
Сообщение: Re: DEFERRABLE NOT NULL constraint
Следующее
От: Chris Angelico
Дата:
Сообщение: Re: DEFERRABLE NOT NULL constraint