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
|
Список | 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 по дате отправления: