Hi I found minor issues.
Doc - missing tag and three whitespaces issues see attached patch Following sentence is hard to read due long nested example If the + path contradicts structure of modified <type>jsonb</type> for any individual + value (e.g. path <literal>val['a']['b']['c']</literal> assumes keys + <literal>'a'</literal> and <literal>'b'</literal> have object values + assigned to them, but if <literal>val['a']</literal> or + <literal>val['b']</literal> is null, a string, or a number, then the path + contradicts with the existing structure), an error is raised even if other + values do conform. It can be divided into two sentences - predicate, and example. Regards Pavel
commit 7ce4fbe2620a5d8efdff963b2368c3d0fd904c59 Author: ok...@github.com <pavel.steh...@gmail.com> Date: Tue Jan 19 19:37:02 2021 +0100 fix whitespaces diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml index 924762e128..4e19fe4fb8 100644 --- a/doc/src/sgml/json.sgml +++ b/doc/src/sgml/json.sgml @@ -613,6 +613,7 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qu e.g. in case of arrays it is a 0-based operation or that negative integers that appear in <literal>path</literal> count from the end of JSON arrays. The result of subscripting expressions is always jsonb data type. + </para> <para> <command>UPDATE</command> statements may use subscripting in the diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c index 306c37b5a6..64979f3a5b 100644 --- a/src/backend/utils/adt/jsonbsubs.c +++ b/src/backend/utils/adt/jsonbsubs.c @@ -342,8 +342,8 @@ jsonb_subscript_fetch_old(ExprState *state, { Jsonb *jsonbSource = DatumGetJsonbP(*op->resvalue); sbsrefstate->prevvalue = jsonb_get_element(jsonbSource, - sbsrefstate->upperindex, - sbsrefstate->numupper, + sbsrefstate->upperindex, + sbsrefstate->numupper, &sbsrefstate->prevnull, false); } @@ -366,7 +366,7 @@ jsonb_exec_setup(const SubscriptingRef *sbsref, /* Allocate type-specific workspace with space for per-subscript data */ workspace = palloc0(MAXALIGN(sizeof(JsonbSubWorkspace)) + - nupper * (sizeof(Datum) + sizeof(Oid))); + nupper * (sizeof(Datum) + sizeof(Oid))); workspace->expectArray = false; ptr = ((char *) workspace) + MAXALIGN(sizeof(JsonbSubWorkspace)); workspace->indexOid = (Oid *) ptr; @@ -379,7 +379,7 @@ jsonb_exec_setup(const SubscriptingRef *sbsref, foreach(lc, sbsref->refupperindexpr) { Node *expr = lfirst(lc); - int i = foreach_current_index(lc); + int i = foreach_current_index(lc); workspace->indexOid[i] = exprType(expr); }