Skip to content

Commit 24a26c9

Browse files
committed
Add hstore_to_jsonb() and hstore_to_jsonb_loose() to hstore documentation.
These were never documented anywhere user-visible. Tut tut.
1 parent 69d3440 commit 24a26c9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

doc/src/sgml/hstore.sgml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,21 @@ b
325325
<row>
326326
<entry><function>hstore_to_json(hstore)</function><indexterm><primary>hstore_to_json</primary></indexterm></entry>
327327
<entry><type>json</type></entry>
328-
<entry>get <type>hstore</type> as a <type>json</type> value</entry>
328+
<entry>get <type>hstore</type> as a <type>json</type> value, converting
329+
all non-null values to JSON strings</entry>
329330
<entry><literal>hstore_to_json('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry>
330331
<entry><literal>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</literal></entry>
331332
</row>
332333

334+
<row>
335+
<entry><function>hstore_to_jsonb(hstore)</function><indexterm><primary>hstore_to_jsonb</primary></indexterm></entry>
336+
<entry><type>jsonb</type></entry>
337+
<entry>get <type>hstore</type> as a <type>jsonb</type> value, converting
338+
all non-null values to JSON strings</entry>
339+
<entry><literal>hstore_to_jsonb('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry>
340+
<entry><literal>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</literal></entry>
341+
</row>
342+
333343
<row>
334344
<entry><function>hstore_to_json_loose(hstore)</function><indexterm><primary>hstore_to_json_loose</primary></indexterm></entry>
335345
<entry><type>json</type></entry>
@@ -338,6 +348,14 @@ b
338348
<entry><literal>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</literal></entry>
339349
</row>
340350

351+
<row>
352+
<entry><function>hstore_to_jsonb_loose(hstore)</function><indexterm><primary>hstore_to_jsonb_loose</primary></indexterm></entry>
353+
<entry><type>jsonb</type></entry>
354+
<entry>get <type>hstore</type> as a <type>jsonb</type> value, but attempt to distinguish numerical and Boolean values so they are unquoted in the JSON</entry>
355+
<entry><literal>hstore_to_jsonb_loose('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry>
356+
<entry><literal>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</literal></entry>
357+
</row>
358+
341359
<row>
342360
<entry><function>slice(hstore, text[])</function><indexterm><primary>slice</primary></indexterm></entry>
343361
<entry><type>hstore</type></entry>
@@ -414,8 +432,10 @@ b
414432

415433
<note>
416434
<para>
417-
The function <function>hstore_to_json</function> is used when an <type>hstore</type>
418-
value is cast to <type>json</type>.
435+
The function <function>hstore_to_json</function> is used when
436+
an <type>hstore</type> value is cast to <type>json</type>.
437+
Likewise, <function>hstore_to_jsonb</function> is used when
438+
an <type>hstore</type> value is cast to <type>jsonb</type>.
419439
</para>
420440
</note>
421441

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy