title: partial update json field in postgres
body: <p>In Postgres I have a table like this:</p>
  
  <pre><code>CREATE TABLE storehouse
  (
    user_id bigint NOT NULL,
    capacity integer NOT NULL,
    storehouse json NOT NULL,
    last_modified timestamp without time zone NOT NULL,
    CONSTRAINT storehouse_pkey PRIMARY KEY (user_id)
  )
  </code></pre>
  
  <p>And <code>storehouse.storehouse</code> is storing data like this:</p>
  
  <pre><code>{
      "slots":[
          {
              "slot" : 1,
              "id" : 938
          },
          {
              "slot" : 2,
              "id" : 127
          },
      ]
  }
  </code></pre>
  
  <p>The thing is, I want to update <code>storehouse.storehouse.slots[2]</code>, but I do not have an idea on how to do it. </p>
  
  <p>I know how to alter the entire <code>storehouse.storehouse</code> field, but I am wondering since Postgres supports <code>json</code> type, it should support partial modify, otherwise that would be no difference between <code>json</code> type and <code>text</code> type. (I know <code>json</code> type also has type validation which is differ to <code>text</code>)</p>