Re: Counting elements of an array - Mailing list pgsql-general

From Tom Lane
Subject Re: Counting elements of an array
Date
Msg-id 21173.983461230@sss.pgh.pa.us
Whole thread Raw
In response to Counting elements of an array  (Renaud Tthonnart <thonnart@amwdb.u-strasbg.fr>)
List pgsql-general
Renaud Tthonnart <thonnart@amwdb.u-strasbg.fr> writes:
> I would like to know how I can get the number of elements of an array.

There is a function that returns an array's dimensions as a text string:

regression=# select array_dims( '{1,2,3}'::int[] );
 array_dims
------------
 [1:3]
(1 row)

regression=# select array_dims( '{{1,2,3},{4,5,6}}'::int[] );
 array_dims
------------
 [1:2][1:3]
(1 row)


            regards, tom lane

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Addison-Wesley looking for authors
Next
From: Denis Perchine
Date:
Subject: Re: Postgres eats up memory when using cursors