On Thu, Oct 15, 2026 at 1:37 PM David G. Johnston <
[email protected]> wrote:

> On Thu, Oct 15, 2026 at 9:12 AM Matemática A3K <[email protected]>
> wrote:
>
>> and something like "index_start to index_end" ("[2 to 3, 5 to 6]") seems
>> unlikely.
>>
>
> The row in question is technically correct.
>

> SELECT jsonb_path_query_array(
>   '[10,20,30,40,50,60]'::jsonb,
>   '$[1 to 2, 4 to 5]'
> ) AS result;
>
> [20, 30, 50, 60]
>

Indeed, thanks for the clarification!


> I'll agree the entire section could stand to use examples, like the ones
> preceding it.
>


> I'd probably also do:
>
> [{index | start_index to end_index}}, ...]
>
> Instead of leaving the inner syntax available only in the prose.
>

I think this is the best solution. When preparing the patch, I realized
that the markup
in the source of the docs is clear:
"
It can be given in two forms:
        <literal><replaceable>index</replaceable></literal>
        or <literal><replaceable>start_index</replaceable> to
<replaceable>end_index</replaceable></literal>.
"
My confusion arose because of how the <literal> is rendered in this context
in HTML.
I find it hard to distinguish the prose from it, I haven't found a way of
changing it and arguing for that change
seems hard because it's entirely subjective on your vision (however, if you
share this concern I can dig further
and ask for help in the docbook community).

Given this, I find this change to better align the row with the others, so
I am attaching a patch.
diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
index 8a2aad5935e..6b521811e7f 100644
--- a/doc/src/sgml/json.sgml
+++ b/doc/src/sgml/json.sgml
@@ -982,14 +982,13 @@ UPDATE table_name SET jsonb_field[1]['a'] = '1';
      <row>
       <entry>
        <para>
-        <literal>[<replaceable>subscript</replaceable>, ...]</literal>
+        <literal>[{<replaceable>index</replaceable> | <replaceable>start_index</replaceable> to <replaceable>end_index</replaceable>}}, ...]
        </para>
       </entry>
       <entry>
        <para>
-        Array element accessor.
-        <literal><replaceable>subscript</replaceable></literal> can be
-        given in two forms: <literal><replaceable>index</replaceable></literal>
+        Array element accessor. It can be given in two forms:
+        <literal><replaceable>index</replaceable></literal>
         or <literal><replaceable>start_index</replaceable> to <replaceable>end_index</replaceable></literal>.
         The first form returns a single array element by its index. The second
         form returns an array slice by the range of indexes, including the

Reply via email to