The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/16/sql-altertable.html Description:
In the examples on https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-NOTES, I suggest adding the following. To make an existing column `NOT NULL` with the least impact on other work: ``` -- prevent new NULL values ALTER TABLE distributors ADD CONSTRAINT street_not_null CHECK (street IS NOT NULL) NOT VALID; -- optionally, pause here to fix existing NULL values ALTER TABLE distributors VALIDATE CONSTRAINT street_not_null; ALTER TABLE distributors ALTER COLUMN street SET NOT NULL; -- check constraint no longer needed ALTER TABLE distributors DROP CONSTRAINT street_not_null; ```