Fix hstore_to_json_loose's detection of valid JSON number values.

Andrew Dunstan <andrew@dunslane.net>

Commit: 55c8807978e86f615623eb7922c114b841f14557
Author: Andrew Dunstan <andrew@dunslane.net>
Date: 2014-12-01T16:44:48Z
Releases: 9.3.6
Fix hstore_to_json_loose's detection of valid JSON number values.

We expose a function IsValidJsonNumber that internally calls the lexer
for json numbers. That allows us to use the same test everywhere,
instead of inventing a broken test for hstore conversions. The new
function is also used in datum_to_json, replacing the code that is now
moved to the new function.

Backpatch to 9.3 where hstore_to_json_loose was introduced.

Files

PathChange+/−
contrib/hstore/hstore_io.c modified +2 −41
src/backend/utils/adt/json.c modified +33 −7
src/include/utils/jsonapi.h modified +7 −0