array_count() function

The array_count() function returns the number of elements in an array.

Syntax

The array_count function has the following syntax:
int = array_count(array input);

The input value specifies the array in which to count elements.

Returns

The function returns the number of array elements.

Example

The following example uses the array_t array from the array() function example:
select array_count(col2)from array_t;
 array_count 
-------------
           2
(1 row)