title: postgres update text column value into integer column
body: <p>I have a PostgreSQL data-table with following data</p>
  
  <pre><code>id    assignmentId    folderId    folderId_new
  1     2274            5332
  2     2274            5348
  3     2274            5349
  4     2274            5350
  46    2277            5355
  75    2275            5351
  76    2275            5352
  77    2275            5353
  78    2275            5354
  ...
  </code></pre>
  
  <p>and columns datatype</p>
  
  <pre><code>id                serial
  assignmentId      integer
  folderId          text
  folderId_new      integer
  </code></pre>
  
  <p>I want to save the values of folderId column to folderId_new column.<br>
  I have tried following queries</p>
  
  <pre><code>update framethreshold set folderId_new = CAST (folderId AS integer)
  
  update framethreshold set folderId_new = folderId::int
  </code></pre>
  
  <p>but results in the error:</p>
  
  <pre class="lang-none prettyprint-override"><code>ERROR: invalid input syntax for integer: "" SQL state: 22P02
  </code></pre>