Forum OpenACS Q&A: Could I alter a column type or modifier in PG ?

As title
There was a thread on column type, see: (well, it is about resizing, rather, not type change...)

As far as modifier is concerned, if you try

ALTER TABLE table ADD COLUMN column integer not null;

you will be prompted with:

ERROR:  Adding NOT NULL columns is not implemented.
        Add the column, then use ALTER TABLE ADD CONSTRAINT.

Then you abide and do this instead:

ALTER TABLE table ADD COLUMN column integer;
ALTER TABLE table ADD CONSTRAINT column_nn CHECK (column is not null);
I believe it's more efficient to have it actually recorded as "not null" at the attribute level than as a check constraint. To do that you can do this:
UPDATE pg_attribute SET attnotnull = TRUE
WHERE attname = 'my_column_name'
AND attrelid = (SELECT oid FROM pg_class WHERE relname = 'my_table_name')
It's quite safe, although you'll need to separately check for any existing NULL values.