Re: Counting elements of an array

From: Renaud Tthonnart <thonnart(at)amwdb(dot)u-strasbg(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Counting elements of an array
Date: 2001-03-02 08:16:47
Message-ID: 3A9F56EF.E30ADE8D@amwdb.u-strasbg.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

> Renaud Tthonnart <thonnart(at)amwdb(dot)u-strasbg(dot)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

Thanks very much Tom, you have helped me a lot.
Renaud THONNART

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Vazsonyi 2001-03-02 09:32:08 Triggered data change violation
Previous Message Richard Huxton 2001-03-02 07:46:30 Re: EXECUTE in PLPGSQL