Re: Accessing array datatype

From: "maria s" <psmg01(at)gmail(dot)com>
To: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Accessing array datatype
Date: 2008-07-28 17:28:01
Message-ID: d9d42a0f0807281028o7bc8db52wfbf9ace5fa69e880@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Oliveiros,
Thanks for your reply and I am sorry I didn't notice that I missed pgsql
email id.

Yes, the solution that you stated is what I am going to do.
First query to get the number of elements in the array, then fetch the
elements by building a query.
I am also using C# and I guess this may be the solution to my problem.

Thank you so much,

Maria

On Mon, Jul 28, 2008 at 1:21 PM, Oliveiros Cristina <
oliveiros(dot)cristina(at)marktest(dot)pt> wrote:

> 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 <psmg01(at)gmail(dot)com>
> *To:* Oliveiros Cristina <oliveiros(dot)cristina(at)marktest(dot)pt>
> *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(dot)cristina(at)marktest(dot)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 <psmg01(at)gmail(dot)com>
>> *To:* Osvaldo Rosario Kussama <osvaldo(dot)kussama(at)gmail(dot)com> ;
>> pgsql-sql(at)postgresql(dot)org ; Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> ; Ivan
>> Sergio Borgonovo <mail(at)webthatworks(dot)it>
>> *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
>>
>>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2008-07-28 18:26:05 Re: Encrytion in postgres field in table
Previous Message Oliveiros Cristina 2008-07-28 17:21:14 Re: Accessing array datatype