title: PostgreSQL: Delete key/value pair from array with json objects
body: <p>I have a table:</p>
  
  <pre><code>CREATE TABLE movies( id text, data jsonb );
  
  INSERT INTO movies(id, data) VALUES (
    '1', 
    {
        "actors": [
          {
              "name": "actor1",
              "email": "actor1@somemail.com"
          },
          {
              "name": "actor2",
              "email": "actor2@somemail.com"
          }
        ]
    }
  );
  </code></pre>
  
  <p>What I want is to delete the <strong>email</strong> field (key + value) from each json object of the actors array.</p>
  
  <p>I've tried the following solution and although it does execute, it doesn't have any effect on the array at all:</p>
  
  <pre><code>update movies
  set data = jsonb_set(data, '{actors}', (data-&gt;'actors') - '{actors, email}')
  where id = '1';
  </code></pre>