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

Commitb416454

Browse files
committed
Document behavior of the .** jsonpath accessor in the lax mode
When the .** jsonpath accessor handles the array, it selects both array andeach of its elements. When using lax mode, subsequent accessors automaticallyunwrap arrays. So, the content of each array element may be selected twice.Even though this behavior is counterintuitive, it's correct because everythingworks as designed. This commit documents it.Backpatch to 12 where the jsonpath language was introduced.Reported-by: Thomas KellererBug: #16828Discussion:https://postgr.es/m/16828-2b0229babfad2d8c%40postgresql.orgDiscussion:https://postgr.es/m/CAPpHfdtS-nNidT%3DEqZbAYOPcnNOWh_sd6skVdu2CAQUGdvpT8Q%40mail.gmail.comAuthor: Alexandex Korotkov, revised by Tom LaneReviewed-by: Alvaro Herrera, Thomas Kellerer, Tom LaneBackpatch-through: 12
1 parent2592be8 commitb416454

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16277,6 +16277,24 @@ strict $.track.segments[*].location
1627716277
</programlisting>
1627816278
</para>
1627916279

16280+
<para>
16281+
The <literal>.**</literal> accessor can lead to surprising results
16282+
when using the lax mode. For instance, the following query selects every
16283+
<literal>HR</literal> value twice:
16284+
<programlisting>
16285+
lax $.**.HR
16286+
</programlisting>
16287+
This happens because the <literal>.**</literal> accessor selects both
16288+
the <literal>segments</literal> array and each of its elements, while
16289+
the <literal>.HR</literal> accessor automatically unwraps arrays when
16290+
using the lax mode. To avoid surprising results, we recommend using
16291+
the <literal>.**</literal> accessor only in the strict mode. The
16292+
following query selects each <literal>HR</literal> value just once:
16293+
<programlisting>
16294+
strict $.**.HR
16295+
</programlisting>
16296+
</para>
16297+
1628016298
</sect3>
1628116299

1628216300
<sect3 id="functions-sqljson-path-operators">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp