Skip to content

Commit 473a352

Browse files
committed
SQL/JSON: Document behavior when input document is not jsonb
The input document to functions JSON_EXISTS(), JSON_QUERY(), JSON_VALUE(), and JSON_TABLE() can be specified as character or UTF8-encoded bytea strings. These are automatically converted to jsonb with an implicit cast before being passed to the jsonpath machinery. In the current implementation, errors that occur when parsing the specified string into a valid JSON document are thrown unconditionally. This means they are not subject to the explicit or implicit ON ERROR clause of those functions, which is a standard- conforming behavior. Add a note to the documentation to mention that. Reported-by: Markus Winand Discussion: https://postgr.es/m/F7DD1442-265C-4220-A603-CB0DEB77E91D%40winand.at
1 parent 5d6c64d commit 473a352

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/src/sgml/func.sgml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18861,6 +18861,16 @@ DETAIL: Missing "]" after array dimensions.
1886118861
</tbody>
1886218862
</tgroup>
1886318863
</table>
18864+
<note>
18865+
<para>
18866+
The <replaceable>context_item</replaceable> expression is converted to
18867+
<type>jsonb</type> by an implicit cast if the expression is not already of
18868+
type <type>jsonb</type>. Note, however, that any parsing errors that occur
18869+
during that conversion are thrown unconditionally, that is, are not
18870+
handled according to the (specified or implicit) <literal>ON ERROR</literal>
18871+
clause.
18872+
</para>
18873+
</note>
1886418874
</sect2>
1886518875

1886618876
<sect2 id="functions-sqljson-table">

0 commit comments

Comments
 (0)