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_util.c

  • Tom Lane's avatar
    4a50de13
    Fix bogus optimization in JSONB containment tests. · 4a50de13
    Tom Lane authored
    When determining whether one JSONB object contains another, it's okay to
    make a quick exit if the first object has fewer pairs than the second:
    because we de-duplicate keys within objects, it is impossible that the
    first object has all the keys the second does.  However, the code was
    applying this rule to JSONB arrays as well, where it does *not* hold
    because arrays can contain duplicate entries.  The test was really in
    the wrong place anyway; we should do it within JsonbDeepContains, where
    it can be applied to nested objects not only top-level ones.
    
    Report and test cases by Alexander Korotkov; fix by Peter Geoghegan and
    Tom Lane.
    4a50de13
    History
    Fix bogus optimization in JSONB containment tests.
    Tom Lane authored
    When determining whether one JSONB object contains another, it's okay to
    make a quick exit if the first object has fewer pairs than the second:
    because we de-duplicate keys within objects, it is impossible that the
    first object has all the keys the second does.  However, the code was
    applying this rule to JSONB arrays as well, where it does *not* hold
    because arrays can contain duplicate entries.  The test was really in
    the wrong place anyway; we should do it within JsonbDeepContains, where
    it can be applied to nested objects not only top-level ones.
    
    Report and test cases by Alexander Korotkov; fix by Peter Geoghegan and
    Tom Lane.