From dbc50acce12efcd25e7c55c51609e125e1545439 Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 25 Jun 2024 12:35:40 +0800 Subject: [PATCH v1 1/1] document how json_value dealing with jsonb 'null' --- doc/src/sgml/func.sgml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 26092696..f6ec96ae 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -18772,7 +18772,7 @@ ERROR: jsonpath array subscript is out of bounds The ON EMPTY clause specifies the behavior if evaluating path_expression yields no value at all. The default when ON EMPTY is not specified - is to return a null value. + is to return an SQL NULL value. The ON ERROR clause specifies the @@ -18781,7 +18781,7 @@ ERROR: jsonpath array subscript is out of bounds coerce the result value to the output type, or during the execution of ON EMPTY behavior (that is caused by empty result of path_expression evaluation). The default - when ON ERROR is not specified is to return a null + when ON ERROR is not specified is to return an SQL NULL value. @@ -18823,8 +18823,13 @@ DETAIL: Missing "]" after array dimensions. The extracted value must be a single SQL/JSON - scalar item; an error is thrown if that's not the case. If you expect - that extracted value might be an object or an array, use the + scalar item; an error is thrown if that's not the case. + If the extracted value is a JSON null, an SQL NULL value will return. + This means that you cannot use json_value to distinguish the JSON value null + from evaluating path_expression yields no value at all; + SQL NULL indicates both cases, + to distinguish these two cases, use json_query instead. + If you expect that extracted value might be an object or an array, use the json_query function instead. -- 2.34.1