v1-0002-Add-docs-for-strip_in_arrays-argument.patch
application/octet-stream
Filename: v1-0002-Add-docs-for-strip_in_arrays-argument.patch
Type: application/octet-stream
Part: 0
Message:
Re: jsonb_strip_nulls with arrays?
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0002
Subject: Add docs for strip_in_arrays argument
| File | + | − |
|---|---|---|
| doc/src/sgml/func.sgml | 9 | 3 |
From a29ac77c075523cf1e885a4b5ade6249b82ec82a Mon Sep 17 00:00:00 2001
From: Florents Tselai <florents.tselai@gmail.com>
Date: Tue, 17 Sep 2024 23:38:01 +0300
Subject: [PATCH v1 2/2] Add docs for strip_in_arrays argument
---
doc/src/sgml/func.sgml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 84eb3a45ee..5840d833d3 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -17119,25 +17119,31 @@ ERROR: value too long for type character(2)
<indexterm>
<primary>json_strip_nulls</primary>
</indexterm>
- <function>json_strip_nulls</function> ( <type>json</type> )
+ <function>json_strip_nulls</function> ( <parameter>target</parameter> <type>jsonb</type>, <optional>,<parameter>strip_in_arrays</parameter> <type>boolean</type> </optional> )
<returnvalue>json</returnvalue>
</para>
<para role="func_signature">
<indexterm>
<primary>jsonb_strip_nulls</primary>
</indexterm>
- <function>jsonb_strip_nulls</function> ( <type>jsonb</type> )
+ <function>jsonb_strip_nulls</function> ( <parameter>target</parameter> <type>jsonb</type>, <optional>,<parameter>strip_in_arrays</parameter> <type>boolean</type> </optional> )
<returnvalue>jsonb</returnvalue>
</para>
<para>
Deletes all object fields that have null values from the given JSON
value, recursively. Null values that are not object fields are
untouched.
+ If <parameter>strip_in_arrays</parameter> is true (default is false), null array elements are also stripped.
</para>
<para>
<literal>json_strip_nulls('[{"f1":1, "f2":null}, 2, null, 3]')</literal>
<returnvalue>[{"f1":1},2,null,3]</returnvalue>
- </para></entry>
+ </para>
+ <para>
+ <literal>jsonb_strip_nulls('[1,2,null,3,4]', true);</literal>
+ <returnvalue>[1,2,3,4]</returnvalue>
+ </para>
+ </entry>
</row>
<row>
--
2.39.3 (Apple Git-146)