Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

jsonb.c

Blame
    • Heikki Linnakangas's avatar
      364ddc3e
      Clean up jsonb code. · 364ddc3e
      Heikki Linnakangas authored
      The main target of this cleanup is the convertJsonb() function, but I also
      touched a lot of other things that I spotted into in the process.
      
      The new convertToJsonb() function uses an output buffer that's resized on
      demand, so the code to estimate of the size of JsonbValue is removed.
      
      The on-disk format was not changed, even though I refactored the structs
      used to handle it. The term "superheader" is replaced with "container".
      
      The jsonb_exists_any and jsonb_exists_all functions no longer sort the input
      array. That was a premature optimization, the idea being that if there are
      duplicates in the input array, you only need to check them once. Also,
      sorting the array saves some effort in the binary search used to find a key
      within an object. But there were drawbacks too: the sorting and
      deduplicating obviously isn't free, and in the typical case there are no
      duplicates to remove, and the gain in the binary search was minimal. Remove
      all that, which makes the code simpler too.
      
      This includes a bug-fix; the total length of the elements in a jsonb array
      or object mustn't exceed 2^28. That is now checked.
      364ddc3e
      History
      Clean up jsonb code.
      Heikki Linnakangas authored
      The main target of this cleanup is the convertJsonb() function, but I also
      touched a lot of other things that I spotted into in the process.
      
      The new convertToJsonb() function uses an output buffer that's resized on
      demand, so the code to estimate of the size of JsonbValue is removed.
      
      The on-disk format was not changed, even though I refactored the structs
      used to handle it. The term "superheader" is replaced with "container".
      
      The jsonb_exists_any and jsonb_exists_all functions no longer sort the input
      array. That was a premature optimization, the idea being that if there are
      duplicates in the input array, you only need to check them once. Also,
      sorting the array saves some effort in the binary search used to find a key
      within an object. But there were drawbacks too: the sorting and
      deduplicating obviously isn't free, and in the typical case there are no
      duplicates to remove, and the gain in the binary search was minimal. Remove
      all that, which makes the code simpler too.
      
      This includes a bug-fix; the total length of the elements in a jsonb array
      or object mustn't exceed 2^28. That is now checked.
    jsonb.c 10.63 KiB