title: Select all columns except for some PostgreSQL
body: <p>I have to compare tables but there are some columns which I don't need to compare and I only know them (not the ones I have to compare) so I want to select all columns from table except the ones that I don't need to compare.</p>
  
  <p>I thought of something like:</p>
  
  <pre><code>SELECT 'SELECT ' || array_to_string(ARRAY(SELECT 'o' || '.' || c.column_name
      FROM information_schema.columns As c
          WHERE table_name = 'office' 
          AND  c.column_name NOT IN('id', 'deleted')
  ), ',') || ' FROM officeAs o' As sqlstmt
  </code></pre>
  
  <p>however the output was <code>SELECT * FROM office As o</code> 
  instead of being <code>select a,b,c from office</code> without <code>id and deleted</code> columns.</p>
  
  <p>Does anyone have any ideas what's wrong with this query?</p>