From: Kris Jurka <books@ejurka.com>
To: Leandro GuimarĂ£es <leo.guimaraes@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bidimensional Array
Date: Mon, 26 Dec 2011 12:41:52 -0800
Message-ID: <4EF8DC10.2020103@ejurka.com> (raw)
In-Reply-To: <CAJV35FPrGAi21sdJ0qTEzj=R5kL23ogFFO8wEmE0TwBu_FCapA@mail.gmail.com>
References: <CAJV35FMHLeieh3zOwzMSvNqnppeEJe4v6fF8diiESVHswQEkzg@mail.gmail.com>
<alpine.BSO.2.00.1112261506090.6857@leary.csoft.net>
<CAJV35FPrGAi21sdJ0qTEzj=R5kL23ogFFO8wEmE0TwBu_FCapA@mail.gmail.com>
On 12/26/2011 12:23 PM, Leandro GuimarĂ£es wrote:
> Hello Kris,
> thanks for your answer. The dataType is varchar.
>
> I did a workaround to solve the problem, but i'm sure it's not a good
> approach.
>
> I'm using the a1.toString() method and using .split by comma to break
> the value and return the String[]
>
Your problem is that you don't really have a two dimensional array. You
have a one dimensional array whose contents look similar to an array,
but are actually just a string of text.
jurka=# select array_ndims('{"{319.1,811.2,915.5}"}'::varchar[]);
array_ndims
-------------
1
Those interior quotes are not correct.
jurka=# select array_ndims('{{319.1,811.2,915.5}}'::varchar[]);
array_ndims
-------------
2
jurka=# select ('{{319.1,811.2,915.5}}'::varchar[])[1][1];
varchar
---------
319.1
Kris Jurka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, leo.guimaraes@gmail.com
Subject: Re: Bidimensional Array
In-Reply-To: <4EF8DC10.2020103@ejurka.com>
References: <CAJV35FMHLeieh3zOwzMSvNqnppeEJe4v6fF8diiESVHswQEkzg@mail.gmail.com> <alpine.BSO.2.00.1112261506090.6857@leary.csoft.net> <CAJV35FPrGAi21sdJ0qTEzj=R5kL23ogFFO8wEmE0TwBu_FCapA@mail.gmail.com> <4EF8DC10.2020103@ejurka.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox