set default value to null on postgresql

alter table dogs
alter column breed set default 'boxer'

alter table dogs
alter column breed set default null

The correct syntax is:

ALTER TABLE table_name ALTER COLUMN column_name SET DEFAULT NULL;

For several columns you repeat the ALTER COLUMN part as documented in the manual:

ALTER TABLE table_name 
    ALTER COLUMN foo SET DEFAULT NULL,
    ALTER COLUMN bar SET DEFAULT 0;

Try like below... it will work....

ALTER TABLE address ALTER COLUMN IsActive SET DEFAULT NULL

You're not running the complete statement. You're missing the ALTER TABLE part:

ALTER TABLE [ ONLY ] name [ * ]
    action [, ... ]
ALTER TABLE [ ONLY ] name [ * ]
    RENAME [ COLUMN ] column TO new_column
ALTER TABLE name
    RENAME TO new_name

where action is one of:
[...]

Tags:

Sql

Postgresql