Subject Re: [IBO] Add NOT NULL constraint within transaction
Author Paul Vinkenoog
Hi David,

> I want to add a NOT NULL constraint to an existing column. Unless
> I'm totally missing something, this can't be done in a single
> command and I'm on board with the idea of using a temporary column
> and accomplishing the task in several steps.

A late reply (maybe too late):

You don't need a temporary column; just issue these two DDL statements
and commit. Supposing the current column type is int:

create domain intnn as int not null;
alter table MyTable alter MyColumn type intnn;

Please make sure that there are no NULLs in the column *before* you
change the type! If you don't, any remaining NULLs will become
"invisible" in most clients, and you will probably only notice their
existence if you try to restore a backup that was made after the
change.


Hope this helps,
Paul Vinkenoog