From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Hannu Krosing <hannu(at)2ndQuadrant(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: jdbc refuses to pass array argument using ARRAY[...] syntax |
Date: | 2009-02-07 16:28:48 |
Message-ID: | Pine.BSO.4.64.0902071122430.8527@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2009-02-07 21:57:24 | Re: jdbc refuses to pass array argument using ARRAY[...] syntax |
Previous Message | Hannu Krosing | 2009-02-07 16:13:55 | jdbc refuses to pass array argument using ARRAY[...] syntax |