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

Commitc30fc9d

Browse files
committed
Documentation improvements to jsonpath
Besides cosmetic improvements it removes statement that operators necessaryneed to be separated from operands with spaces, which is not really true.Discussion:https://postgr.es/m/CAEkD-mDUZrRE%3Dk-FznEg4Ed2VdjpZCyHoyo%2Bp0%2B8KvHqR%3DpNVQ%40mail.gmail.comAuthor: Liudmila Mantrova, Alexander LakhinReviewed-by: Alexander Korotkov, Alvaro HerreraBackpatch-through: 12
1 parentfc16778 commitc30fc9d

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11574,7 +11574,7 @@ table2-mapping
1157411574

1157511575
<para>JSON query functions and operators
1157611576
pass the provided path expression to the <firstterm>path engine</firstterm>
11577-
for evaluation. If the expression matches the JSON data to be queried,
11577+
for evaluation. If the expression matches thequeriedJSON data,
1157811578
the corresponding SQL/JSON item is returned.
1157911579
Path expressions are written in the SQL/JSON path language
1158011580
and can also include arithmetic expressions and functions.
@@ -11634,7 +11634,7 @@ table2-mapping
1163411634

1163511635
<para>
1163611636
If the item to retrieve is an element of an array, you have
11637-
to unnest this array using the [*] operator. For example,
11637+
to unnest this array using the<literal>[*]</literal> operator. For example,
1163811638
the following path will return location coordinates for all
1163911639
the available track segments:
1164011640
<programlisting>
@@ -11655,8 +11655,7 @@ table2-mapping
1165511655
The result of each path evaluation step can be processed
1165611656
by one or more <type>jsonpath</type> operators and methods
1165711657
listed in <xref linkend="functions-sqljson-path-operators"/>.
11658-
Each method must be preceded by a dot, while arithmetic and Boolean
11659-
operators are separated from the operands by spaces. For example,
11658+
Each method name must be preceded by a dot. For example,
1166011659
you can get an array size:
1166111660
<programlisting>
1166211661
'$.track.segments.size()'
@@ -11937,7 +11936,7 @@ table2-mapping
1193711936
</row>
1193811937
<row>
1193911938
<entry><literal>double()</literal></entry>
11940-
<entry>Approximatenumeric value converted from a string</entry>
11939+
<entry>Approximatefloating-point number converted from an SQL/JSON number or a string</entry>
1194111940
<entry><literal>{"len": "1.9"}</literal></entry>
1194211941
<entry><literal>$.len.double() * 2</literal></entry>
1194311942
<entry><literal>3.8</literal></entry>
@@ -11966,10 +11965,10 @@ table2-mapping
1196611965
<row>
1196711966
<entry><literal>keyvalue()</literal></entry>
1196811967
<entry>
11969-
Sequence of object's key-value pairs represented as array ofobjects
11968+
Sequence of object's key-value pairs represented as array ofitems
1197011969
containing three fields (<literal>"key"</literal>,
1197111970
<literal>"value"</literal>, and <literal>"id"</literal>).
11972-
<literal>"id"</literal> isan unique identifier of the object
11971+
<literal>"id"</literal> isa unique identifier of the object
1197311972
key-value pair belongs to.
1197411973
</entry>
1197511974
<entry><literal>{"x": "20", "y": 32}</literal></entry>
@@ -12091,9 +12090,9 @@ table2-mapping
1209112090
<entry><literal>like_regex</literal></entry>
1209212091
<entry>
1209312092
Tests pattern matching with POSIX regular expressions
12094-
(<xref linkend="functions-posix-regexp"/>). Supported flags
12093+
(see<xref linkend="functions-posix-regexp"/>). Supported flags
1209512094
are <literal>i</literal>, <literal>s</literal>, <literal>m</literal>,
12096-
<literal>x</literal> and <literal>q</literal>.</entry>
12095+
<literal>x</literal>, and <literal>q</literal>.</entry>
1209712096
<entry><literal>["abc", "abd", "aBdC", "abdacb", "babc"]</literal></entry>
1209812097
<entry><literal>$[*] ? (@ like_regex "^ab.*c" flag "i")</literal></entry>
1209912098
<entry><literal>"abc", "aBdC", "abdacb"</literal></entry>
@@ -12107,7 +12106,7 @@ table2-mapping
1210712106
</row>
1210812107
<row>
1210912108
<entry><literal>exists</literal></entry>
12110-
<entry>Tests whether a path expressionhas at least one SQL/JSON item</entry>
12109+
<entry>Tests whether a path expressionmatches at least one SQL/JSON item</entry>
1211112110
<entry><literal>{"x": [1, 2], "y": [2, 4]}</literal></entry>
1211212111
<entry><literal>strict $.* ? (exists (@ ? (@[*] > 2)))</literal></entry>
1211312112
<entry><literal>2, 4</literal></entry>
@@ -12332,10 +12331,9 @@ table2-mapping
1233212331
<row>
1233312332
<entry><literal>@@</literal></entry>
1233412333
<entry><type>jsonpath</type></entry>
12335-
<entry>JSON path predicate check result for the specified JSON value.
12336-
Only first result item is taken into account. If there are no results
12337-
or the first result item is not Boolean, then null
12338-
is returned.</entry>
12334+
<entry>Returns the result of JSON path predicate check for the specified JSON value.
12335+
Only the first item of the result is taken into account. If the
12336+
result is not Boolean, then <literal>null</literal> is returned.</entry>
1233912337
<entry><literal>'{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2'</literal></entry>
1234012338
</row>
1234112339
</tbody>
@@ -12973,7 +12971,7 @@ table2-mapping
1297312971
<row>
1297412972
<entry>
1297512973
<para><literal>
12976-
jsonb_path_exists(target jsonb, path jsonpath [, vars jsonb, silent bool])
12974+
jsonb_path_exists(target jsonb, path jsonpath [, vars jsonb [, silent bool]])
1297712975
</literal></para>
1297812976
</entry>
1297912977
<entry><type>boolean</type></entry>
@@ -12998,10 +12996,9 @@ table2-mapping
1299812996
</entry>
1299912997
<entry><type>boolean</type></entry>
1300012998
<entry>
13001-
Returns JSON path predicate result for the specified JSON value.
13002-
Only first result item is taken into account. If there are no results
13003-
or the first result item is not Boolean, then null
13004-
is returned.
12999+
Returns the result of JSON path predicate check for the specified JSON value.
13000+
Only the first item of the result is taken into account. If the
13001+
result is not Boolean, then <literal>null</literal> is returned.
1300513002
</entry>
1300613003
<entry>
1300713004
<para><literal>
@@ -13208,18 +13205,18 @@ table2-mapping
1320813205
<note>
1320913206
<para>
1321013207
The <literal>jsonb_path_exists</literal>, <literal>jsonb_path_match</literal>,
13211-
<literal>jsonb_path_query</literal>, <literal>jsonb_path_query_array</literal> and
13208+
<literal>jsonb_path_query</literal>, <literal>jsonb_path_query_array</literal>, and
1321213209
<literal>jsonb_path_query_first</literal>
1321313210
functions have optional <literal>vars</literal> and <literal>silent</literal>
1321413211
arguments.
1321513212
</para>
1321613213
<para>
13217-
If the <literal>vars</literal> argument is specified, it provides an
13214+
If the <parameter>vars</parameter> argument is specified, it provides an
1321813215
object containing named variables to be substituted into a
1321913216
<literal>jsonpath</literal> expression.
1322013217
</para>
1322113218
<para>
13222-
If the <literal>silent</literal> argument is specified and has the
13219+
If the <parameter>silent</parameter> argument is specified and has the
1322313220
<literal>true</literal> value, these functions suppress the same errors
1322413221
as the <literal>@?</literal> and <literal>@@</literal> operators.
1322513222
</para>

‎doc/src/sgml/json.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,11 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
490490
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ? (@ == "qui")';
491491
</programlisting>
492492
GIN index extracts statements of following form out of
493-
<literal>jsonpath</literal>: <literal>accessors_chain = const</literal>.
493+
<literal>jsonpath</literal>: <replaceable>accessors_chain</replaceable> =<replaceable>const</replaceable>.
494494
Accessors chain may consist of <literal>.key</literal>,
495-
<literal>[*]</literal> and <literal>[index]</literal> accessors.
495+
<literal>[*]</literal>, and <literal>[<replaceable>index</replaceable>]</literal> accessors.
496496
<literal>jsonb_ops</literal> additionally supports <literal>.*</literal>
497-
and <literal>.**</literal>statements.
497+
and <literal>.**</literal>accessors.
498498
</para>
499499
<para>
500500
Another approach to querying is to exploit containment, for example:
@@ -650,12 +650,12 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
650650
<itemizedlist>
651651
<listitem>
652652
<para>
653-
Dot <literal>.</literal> is used for member access.
653+
Dot(<literal>.</literal>) is used for member access.
654654
</para>
655655
</listitem>
656656
<listitem>
657657
<para>
658-
Square brackets <literal>[]</literal> are used for array access.
658+
Square brackets(<literal>[]</literal>) are used for array access.
659659
</para>
660660
</listitem>
661661
<listitem>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp