From: Kris Jurka <books@ejurka.com>
To: Hannu Krosing <hannu@2ndQuadrant.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: jdbc refuses to pass array argument using ARRAY[...] syntax
Date: Sat, 7 Feb 2009 11:28:48 -0500 (EST)
Message-ID: <Pine.BSO.4.64.0902071122430.8527@leary.csoft.net> (raw)
In-Reply-To: <1234023235.9180.19.camel@huvostro>
References: <1234023235.9180.19.camel@huvostro>
On Sat, 7 Feb 2009, Hannu Krosing wrote:
> org.postgresql.util.PSQLException: org.postgresql.util.PSQLException:
> ERROR: array value must start with "{" or dimension information
This is a server error message, not a JDBC driver message.
> and yes, the full query string returned from myPrepared
> Statement.toString() is valid SQL and does produce desired results when
> I paste it in psql, so the problem is very likely overly paranoid checks
> in PG jdbc driver.
>
> m3=# select * from mytypearrayfunc( 1, ARRAY[
> m3(# ROW(7,'{5,6,7}','{4}')::mytype,
> m3(# ROW(2,'{2}','{3,4}')::mytype,
> m3(# ROW(1,'{1}','{}')::mytype
> m3(# ] )
Since you're using a prepared statement, this isn't the same thing. The
equivalent is really:
PREPARE myplan ( mytype[] ) AS SELECT * FROM
mytypearraryfunc($1);
EXECUTE myplan ( 'ARRAY[..]'::mytype[] );
ARRAY is a grammar construct and cannot be part of the parameter.
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, hannu@2ndQuadrant.com
Subject: Re: jdbc refuses to pass array argument using ARRAY[...] syntax
In-Reply-To: <Pine.BSO.4.64.0902071122430.8527@leary.csoft.net>
References: <1234023235.9180.19.camel@huvostro> <Pine.BSO.4.64.0902071122430.8527@leary.csoft.net>
* 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