Search Postgresql Archives

Re: array size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

2011/2/24 akp geek <akpgeek@xxxxxxxxx>
Hi all -

ÂÂ Â Â Â Â Â ÂI am trying to find the number of elements in the array. Right now I am using array_upper and array_lower. Is there any other way of getting the number of elements?
You may use array_length() function, e.g.
dmitigr=> SELECT array_length(ARRAY[ARRAY[1,2,3],ARRAY[4,5,6]], 1);
Âarray_length
--------------
ÂÂÂÂÂÂÂÂÂÂÂ 2
(1 row)

dmitigr=> SELECT array_length(ARRAY[ARRAY[1,2,3],ARRAY[4,5,6]], 2);
Âarray_length
--------------
ÂÂÂÂÂÂÂÂÂÂÂ 3
(1 row)

See http://www.postgresql.org/docs/9.0/static/functions-array.html

thanks for the help

Regards



--
// Dmitriy.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux