Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc27fda6

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 parentc33d1a8 commitc27fda6

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)

[8]ページ先頭

©2009-2025 Movatter.jp