BUG #12070: hstore extension: hstore_to_json_loose produces invalid JSON - Mailing list pgsql-bugs

From bouda@edookit.com
Subject BUG #12070: hstore extension: hstore_to_json_loose produces invalid JSON
Date
Msg-id 20141126081059.15510.5034@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #12070: hstore extension: hstore_to_json_loose produces invalid JSON  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      12070
Logged by:          Ondřej Bouda
Email address:      bouda@edookit.com
PostgreSQL version: 9.4beta2
Operating system:   Windows 7 64bit
Description:

The hstore_to_json_loose(hstore) produces an invalid JSON in the following
case:

SELECT hstore_to_json_loose(hstore(ARRAY ['name'], ARRAY ['1.'] :: TEXT
[]))

Output: {"name": 1.}

Expected:
  either {"name": "1."}
  or     {"name": 1}
  (the latter being the preferred one so that it produces the same JSON as
hstore_to_jsonb_loose(hstore))

The actual output is indeed incorrect as JSON does not permit `1.` - it must
be a string.

Tested with PostgreSQL 9.4 RC1 and still wrong.

pgsql-bugs by date:

Previous
From: tommaso.sala@cla-it.eu
Date:
Subject: BUG #12053: Strange behavior for numeric types with unspecified precision-scale
Next
From: Luciana Campos
Date:
Subject: Fwd: Rocks 6.1.1 with JDBC connection - What should be wrong?