I want to set default value for already existed column of INTEGER type in table.
According to the postgreSQL doc I should use the following statement:
ALTER [ COLUMN ] column_name SET DEFAULT expression
Therefore my sql statement looks like this:
ALTER TABLE users ALTER COLUMN board_consecutive_share_days SET DEFAULT 0;
After I issued the command nothing happened, the default value was't set to the column:
ownpleasuretestdb=# select board_consecutive_share_days from users;
board_consecutive_share_days
------------------------------
(3 rows)
So, please tell me what is wrong in my sql statement?