title: modify only last value in jsonb field
body: <p>I have table with jsonb field</p>
  <p>Example:</p>
  <pre class="lang-none prettyprint-override"><code>id   jsonb_t
  1    [ {&quot;x&quot; : 1 , &quot;y&quot;: 2} , {&quot;x&quot; : 2 , &quot;y&quot;: 3} , {&quot;x&quot;: 3, &quot;y&quot; : 4} ]
  2    [ {&quot;x&quot; : 1 , &quot;y&quot;: 3} , {&quot;x&quot; : 3 , &quot;y&quot;: 3} , {&quot;x&quot;: 8, &quot;y&quot; : 2} ]
  3    [ {&quot;x&quot; : 1 , &quot;y&quot;: 4} , {&quot;x&quot; : 4 , &quot;y&quot;: 3} , {&quot;x&quot;: 5, &quot;y&quot; : 9} ]
  </code></pre>
  <p>I want to modify table where <strong>id = 3</strong> <em>but only the last row in jsonb array of objects</em> , it means replace e.g. <strong>&quot;y&quot;:9</strong> into <strong>&quot;y&quot;:8</strong> , and increment <strong>&quot;x&quot;:5</strong> by <strong>1</strong> to <strong>&quot;x&quot;:6</strong> .
  I can't figure out how to do it in one step (replace and increment should be done &quot;in place&quot; due to thousends rows in jsonb[] array field) , thanks in advance for help .</p>