Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id F09C29FB9F3 for ; Mon, 26 Feb 2007 16:00:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 05059-07-2 for ; Mon, 26 Feb 2007 16:00:32 -0400 (AST) X-Greylist: delayed 01:39:53.447827 by SQLgrey-1.7.4 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with ESMTP id 22AAB9FB9B3 for ; Mon, 26 Feb 2007 16:00:33 -0400 (AST) Received: from [192.168.7.181] (71-208-162-37.hlrn.qwest.net [71.208.162.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail63.csoft.net (Postfix) with ESMTP id 27EF210038; Mon, 26 Feb 2007 12:53:24 -0500 (EST) Message-ID: <45E31E8E.9070305@ejurka.com> Date: Mon, 26 Feb 2007 10:53:18 -0700 From: Kris Jurka User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: mario.splivalo@mobart.hr CC: pgsql-jdbc@postgresql.org Subject: Re: Calling functions with table-based-type parametars References: <1172246374.23787.25.camel@localhost.localdomain> <1172506356.8206.27.camel@localhost.localdomain> <1172510852.974.2.camel@localhost.localdomain> In-Reply-To: <1172510852.974.2.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="------------090509000502090403030006" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200702/138 X-Sequence-Number: 16694 This is a multi-part message in MIME format. --------------090509000502090403030006 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mario Splivalo wrote: >> This is saying you need to write it with a cast from the row to the table >> type: >> >> conn.prepareCall("{call f1(ROW(?, ?)::t1)}") > > Can't do that either. Postgres tells me that there is no type t1: > > 2007-02-26 18:25:19.004 CET [10324] PARSEERROR: type "t1" does > not exist > > I even tried creating type _t1 wich has same member variables as table > rows, and created function f2 wich takes _t1 as parametar, still same > error: type "_t1" does not exsit. > The attached test case works fine for me without a cast. Perhaps you can modify this to show the failure you're getting. Kris Jurka --------------090509000502090403030006 Content-Type: text/java; name="RowFunc.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="RowFunc.java" import java.sql.*; public class RowFunc { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/jurka","jurka",""); Statement stmt = conn.createStatement(); try { stmt.execute("DROP FUNCTION f1(t1)"); } catch (SQLException sqle) { } try { stmt.execute("DROP TABLE t1"); } catch (SQLException sqle) { } stmt.execute("CREATE TABLE t1 (a int, b int)"); stmt.execute("CREATE FUNCTION f1(t1) RETURNS int AS 'SELECT 1' language 'SQL'"); stmt.close(); CallableStatement cs = conn.prepareCall("{? = call f1(ROW(?,?))}"); cs.registerOutParameter(1, Types.INTEGER); cs.setInt(2,2); cs.setInt(3,3); cs.execute(); System.out.println(cs.getInt(1)); } } --------------090509000502090403030006--