Fix IsValidJsonNumber() to notice trailing non-alphanumeric garbage.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 3 Feb 2016 06:39:08 +0000 (01:39 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 3 Feb 2016 06:39:08 +0000 (01:39 -0500)
commitaa223a037be2935dd6e335d94550dc3f53262479
treec406173127d284f7d3c4655aa666ce3bfd576260
parent95a2cca93088fd9f0bdf71b090d2fe00a355257d
Fix IsValidJsonNumber() to notice trailing non-alphanumeric garbage.

Commit e09996ff8dee3f70 was one brick shy of a load: it didn't insist
that the detected JSON number be the whole of the supplied string.
This allowed inputs such as "2016-01-01" to be misdetected as valid JSON
numbers.  Per bug #13906 from Dmitry Ryabov.

In passing, be more wary of zero-length input (I'm not sure this can
happen given current callers, but better safe than sorry), and do some
minor cosmetic cleanup.
contrib/hstore/expected/hstore.out
contrib/hstore/sql/hstore.sql
src/backend/utils/adt/json.c