title: Cast postgresql jsonb value as array of int and remove element from it
body: <p>I'm trying to remove int value from jsonb array of ints in json stored in jsonb value type in db.</p>
  
  <p>I have a json value, like:</p>
  
  <pre><code>select '{"a":[1,3]}'::jsonb-&gt;'a'
  
  ?column?
  ----------
  [1, 3]
  (1 row)
  
  </code></pre>
  
  <p>And i want to remove '1' from it, like that:</p>
  
  <pre><code>select array_remove(ARRAY[1,1,2,3], 1);
   array_remove
  --------------
   {2,3}
  (1 row)
  
  </code></pre>
  
  <p>But if i do something like that:</p>
  
  <pre><code>select array_remove(array('{"a":[1,3]}'::jsonb-&gt;'a'), 1);
  
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>select array_remove('{"a":[1,3]}'::jsonb-&gt;'a'::text::int[], 1);
  </code></pre>
  
  <p>I have an error like:</p>
  
  <pre><code>operator does not exist: jsonb -&gt; integer[]
  </code></pre>
  
  <p>How can i cast json value to array to remove value from it?</p>