Re: Modifying NOT NULL Constraint

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Modifying NOT NULL Constraint
Дата
Msg-id 00e101bfd636$53dfb0d0$0c64010a@kick.com
обсуждение исходный текст
Ответ на Modifying NOT NULL Constraint  ("Dan Wilson" <phpPgAdmin@acucore.com>)
Ответы Re: Modifying NOT NULL Constraint  (JanWieck@t-online.de (Jan Wieck))
Список pgsql-hackers
> 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?

With ALTER TABLE ADD CONSTRAINT on a non-deferrable NOT
NULL it should fail.  At the end of statement the constraint is not
satified,
an exception is raised and the statement is effectively ignored. It's alot
more complicated for deferrable constraints, and I didn't even actually
take that into account when I did the foreign key one (because I just
thought
of it now).

> 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.
True, but it would be nice to be able to add a check constraint later, and
as
long as you're doing it, it seems silly to ignore NOT NULL.




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.0.2 cuts off attribute name
Следующее
От: Murad Nayal
Дата:
Сообщение: info on unixODBC/Postgres driver port to IRIX 6.5.7 64bit