Re: Accessing array datatype - Mailing list pgsql-sql

From Oliveiros Cristina
Subject Re: Accessing array datatype
Date
Msg-id 021201c8f0d6$568bcfd0$ec5a3d0a@marktestcr.marktest.pt
Whole thread Raw
In response to Accessing array datatype  ("maria s" <psmg01@gmail.com>)
Responses Re: Accessing array datatype  ("maria s" <psmg01@gmail.com>)
List pgsql-sql
Maria,
 
Could you explain a little more the background?
What kind of output do you actually want?
.Do you need to retrieve all the arrays in that column in just one query? 
Or just need to get  one with a particular ID?
 
I learned bout the existence of arrays a few days ago :-)
If I had this problem and with my current knowledge on arrays I would issue first one query to obtain the dimension and then programmatically I would build the next query with the exact number of columns (I use C# for client programs).
It would work fine if you are just hunting for a particular record on your table, but I don't know if that's your goal....
 
Also, Please don't send private replies, always include the mailing list address
because someone with more knowledge than me might be able to quickly help you ;-)
 
Best,
Oliveiros
 
----- Original Message -----
From: maria s
Sent: Monday, July 28, 2008 6:03 PM
Subject: Re: [SQL] Accessing array datatype

Hi Oliveiros,
Thank you so much for your reply.
I would like to get the elements of an array as columns instead of getting them as {a,b,..}

May be if I know the array boundary, then I can fetch the elements as I wish.

But I don't know is there any other way to get the data.

Thank you for your reply.

Maria

On Mon, Jul 28, 2008 at 12:56 PM, Oliveiros Cristina <oliveiros.cristina@marktest.pt> wrote:
Maria,
 
You mean your array has a variable size, which you need to know in order to properly construct a query?
 
Dunno much about arrays, but here http://www.postgresql.org/docs/8.3/static/arrays.html is said that array_upper( your_array, 1 ) returns the upper bound of the array...
 
Can this be what you need...?
 
 
Best,
Oliveiros
----- Original Message -----
From: maria s
Sent: Monday, July 28, 2008 5:09 PM
Subject: [SQL] Accessing array datatype

Hi All,
I have an array column in a table.
How can I fetch the elements separately( ie, select arr[1],arr[2]...arr[n]) as a column,
 when I don't know how many elements are there in the array?

Thanks for your help.

Maria

pgsql-sql by date:

Previous
From: "Oliveiros Cristina"
Date:
Subject: Re: Accessing array datatype
Next
From: "maria s"
Date:
Subject: Re: Accessing array datatype