Re: Modifying NOT NULL Constraint

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Modifying NOT NULL Constraint
Дата
Msg-id 13599.960964267@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Modifying NOT NULL Constraint  ("Dan Wilson" <phpPgAdmin@acucore.com>)
Список pgsql-hackers
"Dan Wilson" <dan_wilson@geocities.com> writes:
> So if I'm understanding this correctly, this would be able to remove the NOT
> NULL constraint, but would not be able to set the NOT NULL constraint.  Is
> that correct?

Oh, you can set attnotnull if you feel like it.  My point is just that
nothing much will happen to any existing null values in the column.
It's up to you to check for them first, if you care.

> If that is correct, are their plans to implement a post-create setting of
> the NOT NULL constraint?

What do you think should happen if there are null values?  Refuse the
command?  Delete the non-compliant rows?  Allow the rows to remain
even though the column is now nominally NOT NULL?

You can implement any of these behaviors for yourself with a couple of
SQL commands inside a transaction, so I'm not sure that I see the need
to have a neatly-wrapped-up ALTER TABLE command that will only do one
of the things you might want it to do.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Adding time to DATE type
Следующее
От: "Dan Wilson"
Дата:
Сообщение: Re: Modifying NOT NULL Constraint