title: How to update multiple json fields at root level with Postgres?
body: <p>I am trying to update the fields <code>age</code> and <code>city</code> of one json feed using:</p>
  
  <pre><code>select jsonb_set(d,'{0,age,city}',d || '{"age":30,"city":"los angeles"}') 
  from (
    values ('{"name":"john", "age":26,"city":"new york city"}'::jsonb)
  ) t(d);
  </code></pre>
  
  <p>but what I get back is:</p>
  
  <pre><code>{"age": 26, "city": "new york city", "name": "john"}
  </code></pre>
  
  <p>instead of the expected:</p>
  
  <pre><code>{"age": 30, "city": "los angeles", "name": "john"}
  </code></pre>
  
  <p>that means none of the wanted fields have been updated.</p>
  
  <p>I have already looked at:</p>
  
  <p><a href="https://stackoverflow.com/questions/38883233/postgres-jsonb-set-multiple-keys-update">postgres jsonb_set multiple keys update</a></p>
  
  <p>and went through the relative documentation but I cannot get it right. Any help?</p>