title: Count the number of attributes that are NULL for a row
body: <p>I want to add a new column to a table to record the number of attributes whose value are null for each tuple (row). How can I use SQL to get the number?</p>
  
  <p>for example, if a tuple is like this:</p>
  
  <pre><code>Name | Age | Sex
  -----+-----+-----
  Blice| 100 | null
  </code></pre>
  
  <p>I want to update the tuple as this:</p>
  
  <pre><code>Name | Age | Sex | nNULL
  -----+-----+-----+--------
  Blice| 100 | null|  1
  </code></pre>
  
  <p>Also, because I'm writing a PL/pgSQL function and the table name is obtained from argument, I don't know the schema of a table beforehand. That means I need to update the table with the input table name. Anyone know how to do this?</p>