+ /* Validate target is an array */ + if (JsonbType(jb) != jbvArray) + { + RETURN_ERROR(ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("jsonpath item method .join() can only be applied to an array"))));
Other methods seem to use ERRCODE_SQL_JSON_ARRAY_NOT_FOUND
+ else + { + /* Recursive Tree (jbvArray) */ + for (int i = 0; i < jb->val.array.nElems; i++)
Isn't this branch unreachable?
both of your points are correct.
Here's a v3 that address them .
While at it, I've added some additional edge cases about these 3 methods.
The semantics look good to me, and they pass without additional change in the underlying src code in jsonpath_exec.c