Updating every cell of of a table? I have a table with m columns and n rows. The ETL tools I 
was using wrote an empty ('') to every cell without a value and I would like
them to be NULL instead.  This got me thinking if it would be
possible to UPDATE every cell with value '' with a NULL, in a single statement?
In my table every column happens to be VARCHAR (or CHARACTER VARYING).

    Col1|Col2|...|Coln          Col1|Col2|...|Coln
Row1   a   ''  ''    1      Row1   a NULL NULL   1
Row2   c   ''   e   ''      Row2   c NULL   e NULL
...                     --&gt;  ...
Rown  aa    f  ''  123      Rown  aa    f NULL 123


Is it possible with SQL?  How about PL/pgSQL?  I did some 
googling around but couldn't find anything really relevant.
You can use either n UPDATE statements, one for each column:

UPDATE table SET Col1 = NULL WHERE Col1 = '';
UPDATE table SET Col2 = NULL WHERE Col2 = '';
---
UPDATE table SET ColN = NULL WHERE ColN = '';


or one with CASE:

UPDATE table 
SET Col1 = CASE WHEN Col1 = '' THEN NULL ELSE Col1 END,
    Col2 = CASE WHEN Col2 = '' THEN NULL ELSE Col2 END,
    ---
    ColN = CASE WHEN ColN = '' THEN NULL ELSE ColN END 
WHERE                                           
    Col1 = '' OR Col2 = '' OR ... OR ColN = '' ;      --- optional WHERE clause  


The WHERE clause is not needed. But in case you run this again later, when there are very few rows with nulls, it will help to keep the transaction "smaller", updating only those rows and not the whole table.

Another equivalent, just shorter syntax, using the NULLIF() function:

UPDATE table 
SET Col1 = NULLIF(Col1, ''),
    Col2 = NULLIF(Col2, ''),
    ---
    ColN = NULLIF(ColN, '')
WHERE                                           
    Col1 = '' OR Col2 = '' OR ... OR ColN = '' ;      --- optional WHERE clause