Update Table Column in Postgres

Posted by yhuang
Public (Editable by Users)
SQL
None
Edit
# Change column type.
ALTER TABLE some_table ALTER COLUMN some_column TYPE varchar(500);

# Make column not accept nulls.
ALTER TABLE some_table ALTER COLUMN some_column SET NOT NULL;

# Make column accept nulls.
ALTER TABLE some_table ALTER COLUMN some_column DROP NOT NULL;

# Drop default.
ALTER TABLE some_table ALTER column some_column DROP default;