|
325 | 325 | <row>
|
326 | 326 | <entry><function>hstore_to_json(hstore)</function><indexterm><primary>hstore_to_json</primary></indexterm></entry>
|
327 | 327 | <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> |
329 | 330 | <entry><literal>hstore_to_json('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4')</literal></entry>
|
330 | 331 | <entry><literal>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</literal></entry>
|
331 | 332 | </row>
|
332 | 333 |
|
| 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"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>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 | + |
333 | 343 | <row>
|
334 | 344 | <entry><function>hstore_to_json_loose(hstore)</function><indexterm><primary>hstore_to_json_loose</primary></indexterm></entry>
|
335 | 345 | <entry><type>json</type></entry>
|
|
338 | 348 | <entry><literal>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</literal></entry>
|
339 | 349 | </row>
|
340 | 350 |
|
| 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"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>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 | + |
341 | 359 | <row>
|
342 | 360 | <entry><function>slice(hstore, text[])</function><indexterm><primary>slice</primary></indexterm></entry>
|
343 | 361 | <entry><type>hstore</type></entry>
|
|
414 | 432 |
|
415 | 433 | <note>
|
416 | 434 | <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>. |
419 | 439 | </para>
|
420 | 440 | </note>
|
421 | 441 |
|
|
0 commit comments