title: invalid input syntax for integer: "1" postgresql
body: <p>PostgreSql gives me this error when i try to cast a TEXT colum to a integer. </p>
  
  <pre><code>select pro_id::integer  from mmp_promocjas_tmp limit 1;
  </code></pre>
  
  <p>This colum contains only digits, valid integer. How can "1" be invalid integer? </p>
  
  <pre><code>select pro_id, length(pro_id) ,length(trim(pro_id)) from mmp_promocjas_tmp limit 1;
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>1 | 2 | 2
  </code></pre>
  
  <p>Query <code>select pro_id  from mmp_promocjas_tmp where trim(pro_id) = '1'</code> shows nothing. </p>
  
  <p>I tried to remove whitespaces, without no result:</p>
  
  <pre><code>select pro_id  from mmp_promocjas_tmp  where  regexp_replace(trim(pro_id), '\s*', '', 'g')
  </code></pre>