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

hstore

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Tom Lane authored
    Commit e09996ff removed some ad-hoc code in hstore_to_json_loose
    that determined whether an hstore value string looked like a number,
    in favor of calling the JSON parser's is-it-a-number code.  However,
    it neglected the fact that the exact same code appeared in
    hstore_to_jsonb_loose.
    
    This is not a bug, exactly, because the requirements on the two functions
    are not the same: hstore_to_json_loose must accept only syntactically legal
    JSON numbers as numbers, or it will produce invalid JSON output, as per bug
    #12070 which spawned the prior commit.  But hstore_to_jsonb_loose could
    accept anything that numeric_in will eat, other than Inf and NaN.
    
    Nonetheless it seems surprising and arbitrary that the two functions don't
    use the same rules for what is a number versus what is a string; especially
    since they did use the same rules before the aforesaid commit.  For one
    thing, that means that doing hstore_to_json_loose and then casting to jsonb
    can produce results different from doing just hstore_to_jsonb_loose.
    
    Hence, change hstore_to_jsonb_loose's logic to match hstore_to_json_loose,
    ie, hstore values are treated as numbers when they match the JSON syntax
    for numbers.
    
    No back-patch, since this is more in the nature of a definitional change
    than a bug fix.
    41d2c081
    History