Re: number of elements in a multidimensional array - Mailing list pgsql-general

From SunWuKung
Subject Re: number of elements in a multidimensional array
Date
Msg-id 1157107350.264541.114260@p79g2000cwp.googlegroups.com
Whole thread Raw
In response to number of elements in a multidimensional array  ("SunWuKung" <Balazs.Klein@t-online.hu>)
List pgsql-general
SunWuKung wrote:
> >From this array how could I get back the fact that this array consists
> of a two dimensional array with X elements?
>
> Select array_dims('{{1,4,10,11},{1,5,4,5}}'::text [])
>
> I would like to get back the number 4 here?
>
> Thanks for the help.
> Balázs

This is what I came up with finally, not very elegant but seems to do
the job:
Select substring(array_dims('{{1,4,10,11},{1,5,4,5}}'::text []) from
'([0-9]*)]$')


pgsql-general by date:

Previous
From: nhrcommu@rochester.rr.com
Date:
Subject: Training (from Thought provoking...)
Next
From: "Dan"
Date:
Subject: Create user or role from inside a function?