Thread: BUG #14213: bug in hstore_to_json_loose() function

BUG #14213: bug in hstore_to_json_loose() function

From
knut@wehrle.org
Date:
VGhlIGZvbGxvd2luZyBidWcgaGFzIGJlZW4gbG9nZ2VkIG9uIHRoZSB3ZWJz
aXRlOgoKQnVnIHJlZmVyZW5jZTogICAgICAxNDIxMwpMb2dnZWQgYnk6ICAg
ICAgICAgIEtudXQgV2VocmxlCkVtYWlsIGFkZHJlc3M6ICAgICAga251dEB3
ZWhybGUub3JnClBvc3RncmVTUUwgdmVyc2lvbjogOS40LjUKT3BlcmF0aW5n
IHN5c3RlbTogICBXaW5kb3cgNyBQcm8gU1AxCkRlc2NyaXB0aW9uOiAgICAg
ICAgCgpJIGdldCBhbiBhcnJvdyB3aXRoIHRoZSBmb2xsb3dpbmcgY29tbWFu
ZDoNCg0Kc2VsZWN0IGhzdG9yZV90b19qc29uX2xvb3NlKGhzdG9yZSgnImRh
dGUiPT4iMjAxNi0wNi0yNCInKSktPj4nZGF0ZScNCg0KVGhlIHByb2JsZW0g
aXMsIHRoYXQgdGhlIGZ1bmN0aW9uIGlzIG5vdCBnZW5lcmF0aW5nIGFuIElT
TyBkYXRlIHN0cmluZyBidXQgYQptYXRoZW1hdGljYWwgZm9ybXVsYTogMjAx
NiAtIDA2IC0gMjQgPSAxOTg2IQ0KDQpQcm9iYWJseSB0aGlzIGlzIHRoZSBp
bnRlbmRlZCB3YXkgdG8gaGFuZGxlIHRoaXMga2luZCBvZiBkYXRhLCBidXQg
dGhlbiB0aGUKJy0+Picgb3BlcmF0b3Igd291bGQgYmUgYnVnZ3kuDQoNCnJl
Z2FyZHMga251dAoK

Re: BUG #14213: bug in hstore_to_json_loose() function

From
Tom Lane
Date:
knut@wehrle.org writes:
> PostgreSQL version: 9.4.5

> I get an arrow with the following command:
> select hstore_to_json_loose(hstore('"date"=>"2016-06-24"'))->>'date'

It's hard to be sure, but I think this might be the same as bug #13906
which was fixed in 9.4.6.  If updating doesn't resolve it for you, please
resubmit with a more precise description of what's wrong.

            regards, tom lane

Re: BUG #14213: bug in hstore_to_json_loose() function

From
Alvaro Herrera
Date:
knut@wehrle.org wrote:

> I get an arrow with the following command:
>
> select hstore_to_json_loose(hstore('"date"=>"2016-06-24"'))->>'date'
>
> The problem is, that the function is not generating an ISO date string but a
> mathematical formula: 2016 - 06 - 24 = 1986!
>
> Probably this is the intended way to handle this kind of data, but then the
> '->>' operator would be buggy.

Knut replied to the moderation notice to indicate that 9.4.8 fixed the
issue, and asked for a version log.  Here's the git repository:
https://git.postgresql.org/gitweb/?p=postgresql.git

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services