Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D6583632E3A for ; Sat, 7 Feb 2009 12:28:52 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 31819-09 for ; Sat, 7 Feb 2009 12:28:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 321D2632E39 for ; Sat, 7 Feb 2009 12:28:50 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 65AB4A1E5; Sat, 7 Feb 2009 11:28:48 -0500 (EST) Date: Sat, 7 Feb 2009 11:28:48 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Hannu Krosing cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc refuses to pass array argument using ARRAY[...] syntax In-Reply-To: <1234023235.9180.19.camel@huvostro> Message-ID: References: <1234023235.9180.19.camel@huvostro> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/18 X-Sequence-Number: 19293 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