aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2019-05-17 05:47:53 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2019-05-19 07:43:19 +0300
commit87bcc02f4f739d76703feee0ff8346b98fa9b907 (patch)
tree631dc5c36b11c0479cf9667926b0cf5d87b77b8e /doc/src
parente0e3dad770d3eefc4ee6cd562d9c25b61c263a6e (diff)
downloadpostgresql-87bcc02f4f739d76703feee0ff8346b98fa9b907.tar.gz
postgresql-87bcc02f4f739d76703feee0ff8346b98fa9b907.zip
Improve documentation for array subscription in jsonpath
Usage of expressions and multiple ranges in jsonpath array subscription was undocumented. This commit adds lacking documentation.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/json.sgml21
1 files changed, 13 insertions, 8 deletions
diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
index fae13743984..b8246badda9 100644
--- a/doc/src/sgml/json.sgml
+++ b/doc/src/sgml/json.sgml
@@ -836,17 +836,22 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
<para>
<literal>[<replaceable>subscript</replaceable>, ...]</literal>
</para>
- <para>
- <literal>[<replaceable>subscript</replaceable> to last]</literal>
- </para>
</entry>
<entry>
<para>
- Array element accessor. The provided numeric subscripts return the
- corresponding array elements. The first element in an array is
- accessed with [0]. The <literal>last</literal> keyword denotes
- the last subscript in an array and can be used to handle arrays
- of unknown length.
+ Array element accessor. <literal><replaceable>subscript</replaceable></literal>
+ might be given in two forms: <literal><replaceable>expr</replaceable></literal>
+ or <literal><replaceable>lower_expr</replaceable> to <replaceable>upper_expr</replaceable></literal>.
+ The first form specifies single array element by its index. The second
+ form specified array slice by the range of indexes. Zero index
+ corresponds to the first array element.
+ </para>
+ <para>
+ Expression inside subscript may consititue an integer,
+ numeric expression or any other <literal>jsonpath</literal> expression
+ returning single numeric value. The <literal>last</literal> keyword
+ can be used in the expression denoting the last subscript in an array.
+ That's helpful for handling arrays of unknown length.
</para>
</entry>
</row>