From b523a5c0e5329f7b9e1f15a189dda6936384e630 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 3 Feb 2016 12:56:40 -0500 Subject: [PATCH] Add hstore_to_jsonb() and hstore_to_jsonb_loose() to hstore documentation. These were never documented anywhere user-visible. Tut tut. --- doc/src/sgml/hstore.sgml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml index 94f01f8dfe..5c411950dd 100644 --- a/doc/src/sgml/hstore.sgml +++ b/doc/src/sgml/hstore.sgml @@ -325,11 +325,21 @@ b hstore_to_json(hstore)hstore_to_json json - get hstore as a json value + get hstore as a json value, converting + all non-null values to JSON strings hstore_to_json('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') {"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"} + + hstore_to_jsonb(hstore)hstore_to_jsonb + jsonb + get hstore as a jsonb value, converting + all non-null values to JSON strings + hstore_to_jsonb('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') + {"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"} + + hstore_to_json_loose(hstore)hstore_to_json_loose json @@ -338,6 +348,14 @@ b {"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4} + + hstore_to_jsonb_loose(hstore)hstore_to_jsonb_loose + jsonb + get hstore as a jsonb value, but attempt to distinguish numerical and Boolean values so they are unquoted in the JSON + hstore_to_jsonb_loose('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') + {"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4} + + slice(hstore, text[])slice hstore @@ -414,8 +432,10 @@ b - The function hstore_to_json is used when an hstore - value is cast to json. + The function hstore_to_json is used when + an hstore value is cast to json. + Likewise, hstore_to_jsonb is used when + an hstore value is cast to jsonb.