JDBC and array of points

From: Sumit Raja <sumit(dot)raja(at)raja-consulting(dot)co(dot)uk>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: JDBC and array of points
Date: 2013-02-23 07:30:24
Message-ID: CAB4mO2f5aRWduCwcouypHOF+cZ=5tQd9_Dn_nYd-=BUQEnML+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've posted this to the postgis user group as well, but I think the issue
may just be with my inability to understand the explicit casting in 9.2.

I have code that generates a PreparedStatement that accepts an array of
points in an ANY clause. I convert the point objects in java to a string
"POINT(lon,lat)" and use this in the createArrayOf JDBC method.

Unfortunately this doesn't work any more (used to work on 9.1 + 1.5). The
statement generated is

{"POINT (51.495727 -0.247342)","POINT (1.495727 52.247342)","POINT
(51.495727 -34.247342)"}

which results in "ERROR: malformed array literal".

How can I fix this issue? In psql using the ARRAY[] operator with relevant
casting seems to work (SELECT ARRAY['POINT(-71.064544
42.28787)'::geography]) but as JDBC uses the {} operator I can't see how to
make this work.

Any one have any ideas?

Thanks

Sumit

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-02-23 10:26:48 Re: Dumb question involving to_tsvector and a view
Previous Message JD Wong 2013-02-22 23:46:24 broke postgres, how to fix??