This is an automated email from the ASF dual-hosted git repository. reshke pushed a commit to branch address_1566_p2 in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 62a0c1e0cdd18e501cbffa426a77f7f3839ba41e Author: Bruce Momjian <[email protected]> AuthorDate: Fri Jul 8 20:23:35 2022 -0400 doc: add examples for array_length() and jsonb_array_length() The examples show the output of array_length() and jsonb_array_length() for empty arrays. Discussion: https://postgr.es/m/cakfquwaobmruwdmlzlhdcfdjdx3wvfq7egaf0bpik_bfgg1...@mail.gmail.com Author: David G. Johnston Backpatch-through: 13 --- doc/src/sgml/func.sgml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8266615ea47..ceb09d788cc 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -15446,6 +15446,10 @@ table2-mapping <para> <literal>json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]')</literal> <returnvalue>5</returnvalue> + </para> + <para> + <literal>jsonb_array_length('[]')</literal> + <returnvalue>0</returnvalue> </para></entry> </row> @@ -17887,10 +17891,19 @@ SELECT NULLIF(value, '(none)') ... </para> <para> Returns the length of the requested array dimension. + (Produces NULL instead of 0 for empty or missing array dimensions.) </para> <para> <literal>array_length(array[1,2,3], 1)</literal> <returnvalue>3</returnvalue> + </para> + <para> + <literal>array_length(array[]::int[], 1)</literal> + <returnvalue>NULL</returnvalue> + </para> + <para> + <literal>array_length(array['text'], 2)</literal> + <returnvalue>NULL</returnvalue> </para></entry> </row> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
