Re: array size - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: array size
Date
Msg-id AANLkTimroWdjrfcDkqT4BX4c+iuXhDHcv6ZCVm00o94M@mail.gmail.com
Whole thread Raw
In response to array size  (akp geek <akpgeek@gmail.com>)
Responses Re: array size
List pgsql-general
Hey,

2011/2/24 akp geek <akpgeek@gmail.com>
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.


pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: Re: regexp problem
Next
From: Aleksey Tsalolikhin
Date:
Subject: Re: database is bigger after dump/restore - why? (60 GB to 109 GB)