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_BFgG1KWg@mail.gmail.com Author: David G. Johnston Backpatch-through: 13
This commit is contained in:
parent
aa31b29375
commit
2373fe78df
@ -15867,6 +15867,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>
|
||||
|
||||
@ -19238,10 +19242,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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user