How to Increment duplicate strings in a column
You can use the row number window function for this (http://www.postgresql.org/docs/9.2/static/functions-window.html)

SELECT col || ' ' || row_number() OVER (PARTITION BY col) 
FROM test_a;


Output will be:

+------------+
| ?column?   |
|------------|
| bar 1      |
| bar 2      |
| bar 3      |
| bar 4      |
| foo 1      |
| foo 2      |
| foo 3      |
| foo 4      |
+------------+