Re: Bidimensional Array - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Bidimensional Array
Date
Msg-id 4EF8DC10.2020103@ejurka.com
Whole thread Raw
In response to Bidimensional Array  (Leandro Guimarães <leo.guimaraes@gmail.com>)
List pgsql-jdbc
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



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Bidimensional Array
Next
From: Maciek Sakrejda
Date:
Subject: Re: test git conversion