title: PostgreSQL: how to efficiently alter multiple columns from psql?
body: <p>I have PostgreSQL table with several boolean columns, currently containing only true or null. I want to do the following for all of them:</p>
  
  <ol>
  <li>Add a default value of false</li>
  <li>Change all null values to false</li>
  <li>Add a <code>not null</code> constraint</li>
  </ol>
  
  <p>ie.:</p>
  
  <pre><code>-- for each column specified:
  update my_table set my_column = 'f' where my_column is null;
  alter table my_table alter column my_column set default 'f';
  alter table my_table alter column my_column set not null; 
  </code></pre>
  
  <p>Is there a feature of psql (or standard SQL) that will iterate over a specified list of columns and apply a sequence of operations to each one?</p>