How to drop all NOT NULL constraints from a PostgreSQL table in one go
You can group them all in the same alter statement: alter table tbl alter col1 drop not null, alter col2 drop not null, … You can also retrieve the list of relevant columns from the catalog, if you feel like writing a do block to generate the needed sql. For instance, something like: select a.attname … Read more