Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E6E0B6330CA for ; Wed, 5 Aug 2009 07:41:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 70184-07 for ; Wed, 5 Aug 2009 10:40:56 +0000 (UTC) X-Greylist: delayed 00:05:03.263829 by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id CAD5D632EFB for ; Wed, 5 Aug 2009 07:41:01 -0300 (ADT) Received: from localhost (lpzg-4dbdc4ae.pool.einsundeins.de [77.189.196.174]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MKt2u-1MYdqd1Gup-000c9Q; Wed, 05 Aug 2009 12:35:56 +0200 Date: Wed, 5 Aug 2009 12:35:47 +0200 From: Michael Schwipps To: pgsql-jdbc@postgresql.org Subject: float4 or real in function parameter -> PSQLException: ERROR function in_test4(double precision) does not exist Message-ID: <20090805103547.GA19462@codersinn.mschwipps.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RASg3xLB4tUQ4RcS" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-06-28) X-Provags-ID: V01U2FsdGVkX1962MmK4TI7eeRuW5PhSt1zMGLW3Jln8hN0IWa /A4K6VoyrJmYYKxbaRjujdnqUMhVjei7XavyAwKd6vWJCRJUbg gyYEMe3sCJLBx8sUfzs9Q== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/6 X-Sequence-Number: 19855 --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, We use database functions in our application. Today I want to use a float4/real Parameter for the first time. You can see a sample in in_test4. Float8/double-parameters run fine. The test.sql creates a small test database. The Float4Test.java contains the code sample, which throws the following exception. | Hint: No function matches the given name and argument types. You | might need to add explicit type casts. | Position: 8 | at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) | at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) | at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) | at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:360) | at Float4Test.main(Float4Test.java:24) If I call | Select in_test4(0.4) ; in psql, everything runs fine. Is it a bug in the JDBC-driver? I use postgres 8.4.0 and driver postgresql-8.4-701.jdbc4.jar. Ciao Michael --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="Float4Test.java" import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class Float4Test { public static void main(String[] args) { try { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost/test", "postgres", "postgres"); conn.setAutoCommit(false); PreparedStatement st = conn.prepareStatement("Select in_test8(?);"); st.setFloat(1, 0.8f); st.execute(); st.close(); conn.commit(); st = conn.prepareStatement("Select in_test4(?);"); st.setFloat(1, 0.4f); st.execute(); st.close(); conn.commit(); conn.close(); } catch(Exception e) { e.printStackTrace(); } } } --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="test.sql" create table float4test (id serial primary key, nr float4); create language plpgsql; CREATE OR REPLACE FUNCTION in_test4(pnr float4) RETURNS integer AS $$ DECLARE datas RECORD; BEGIN Insert into float4test (nr) values (pnr) returning id into datas; RETURN datas.id; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION in_test8(pnr float8) RETURNS integer AS $$ DECLARE datas RECORD; BEGIN Insert into float4test (nr) values (pnr) returning id into datas; RETURN datas.id; END; $$ LANGUAGE plpgsql; --RASg3xLB4tUQ4RcS--