I'd like to update all records wi开发者_如何学Goth an empty string in all columns of all tables in PostgreSQL. Is there a way to do this with a query? Or at least how to query for all columns that don't have a NOT NULL constraint.
Visit the information_schema like this
select *
from information_schema.columns
where is_nullable = 'YES';
From that data you can generate yourself update statements for all the tables and columns.
精彩评论