title: How to update a value inside nested arrays in a jsonb object?
body: <p>I got the following <code>jsonb</code> content in PostgreSQL:</p>
  
  <pre><code>{
      "segments": [
          {
              "type": "year",
              "settings": [
                  {
                      "name": "length",
                      "value": "4"
                  }
              ]
          },
          {
              "type": "month",
              "settings": [
                  {
                      "name": "length",
                      "value": "2"
                  }
              ]
          },
          {
              "type": "dayOfMonth",
              "settings": [
                  {
                      "name": "length",
                      "value": "2"
                  }
              ]
          },
          {
              "type": "autoIncrement",
              "settings": [
                  {
                      "name": "scope",
                      "value": "plant"
                  },
                  {
                      "name": "period",
                      "value": "day"
                  },
                  {
                      "name": "length",
                      "value": "10"
                  },
                  {
                      "name": "paddingCharactor",
                      "value": "0"
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>and I want update the period from 'day' to 'forever' in <em>segments -> type=autoIncrement -> settings -> period</em></p>
  
  <p>I have tried <code>jsonb_set</code> and manually combine data after split it, both failed.</p>
  
  <p>Is there any idea for updating the value?</p>