title: Split single JSON array column and update multiple integer columns with this data
body: <p>I have a table with a JSON array column containing an integer of every hour of the day, e.g.:</p>
  <pre><code>[0, 10, 15, 20, 25, 30, 44, 62, 47, 20, 6, 10, 26, 42, 39, 21, 6, 0, 0, 0, 0, 0, 0, 0]
  </code></pre>
  <p>In the same table I have added 24 new integer columns named i0 till i23 so I can easier filter on each individual column without complicated JSON queries.</p>
  <p>With which SQL query can I update the 24 columns with the values from the JSON array, like the example below?
  I need to split the JSON array into 24 values and meanwhile update each row in the same table.</p>
  <pre><code>i0=0, i1=10, i2=15, ..... i23=0
  </code></pre>
  <p>I tried something like this, but then I'm getting a error 'Query 1 ERROR: ERROR:  cannot cast type json to integer'</p>
  <pre><code>UPDATE table
  set 
  i0=CAST (jsoncol::json-&gt;0 AS INTEGER),
  i1=CAST (jsoncol::json-&gt;1 AS INTEGER)
  </code></pre>