Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 339149FC025 for ; Fri, 23 Feb 2007 12:00:10 -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 35307-10 for ; Fri, 23 Feb 2007 11:59:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from pjetlic.mobart.hr (pjetlic.mobart.hr [80.80.51.10]) by postgresql.org (Postfix) with ESMTP id A51229FB55C for ; Fri, 23 Feb 2007 11:59:47 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by pjetlic.mobart.hr (Postfix) with ESMTP id 59E5A186CC for ; Fri, 23 Feb 2007 16:59:45 +0100 (CET) Received: from pjetlic.mobart.hr ([127.0.0.1]) by localhost (pjetlic [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30472-03-2 for ; Fri, 23 Feb 2007 16:59:34 +0100 (CET) Received: from mike.mobart.hr (mike.mobart.hr [192.168.10.94]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by pjetlic.mobart.hr (Postfix) with ESMTP id 8F7B4186AD for ; Fri, 23 Feb 2007 16:59:34 +0100 (CET) Subject: Calling functions with table-based-type parametars From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: pgsql-jdbc@postgresql.org Content-Type: text/plain Organization: Mob-Art d.o.o. Date: Fri, 23 Feb 2007 16:59:34 +0100 Message-Id: <1172246374.23787.25.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by OpenSource AV+AS Mail Server X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/121 X-Sequence-Number: 16677 Hello again :) I have a PSQL function that accepts table-based-type as parametar: CREATE TABLE t1(c1 int4, c2 varchar); CREATE FUNCTION f1(t1) RETURNS VOID AS 'BEGIN RETURN END;' LANGUAGE 'plpgsql'; Now, when I call this function from another function (or from psql, for instance), i need to do it like this: select f1(ROW(1, 'sometext')); How do I do that from JDBC? Usualy I did it like this: callStatement = conn.getCallStatement("{call f1(?, ?)}"); callStatement.setInt(1, 1); callStatement.setString(2, 'sometext'); callStatement.execute(); ResultSet rs = callStatement.getResultSet(); But when I do it like that I get 'function does not exists', which is logical (my function accepts one, not two parametars). I have found out that I can use createstatement like this: Connection c = DriverManager.getConnection('jdbc://...'); s = c.createStatement(); ResultSet rs = s.executeQuery("select f1(ROW(1, 'sometext'));"); Now, as I understand, first snippet uses prepared statements, and second one doesnt. Can I have prepared statements and still pass ROW as function parametar? Or JDBC does not support that? Mike