I have table in postgresql database.
For given column I set default value, then I want it to be NOT NULL
:
ALTER TABLE "order" ALTER COLUMN last_bill_date SET DEFAULT '-Infinity';
ALTER TABLE "order" ALTER COLUMN last_bill_date SET NOT NULL;
But second statement fails:
ERROR: column "last_bill_date" contains null values
Why DEFAULT
value is not used when NOT NULL
is applied for this column?