Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 4CD0E9F9EEC for ; Wed, 15 Nov 2006 12:36:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 59675-02-3 for ; Wed, 15 Nov 2006 16:35:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 312E89FA5FE for ; Wed, 15 Nov 2006 12:30:09 -0400 (AST) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 15 Nov 2006 08:27:26 -0800 Subject: Re: CallableStatement.setTimestamp bug From: Mark Lewis To: Dave Cramer Cc: Reuben Pasquini , pgsql-jdbc@postgresql.org In-Reply-To: <4CD3B5C0-63AC-404B-8F35-9A506180E1FA@fastcrypt.com> References: <1163602021.8021.0.camel@archimedes> <4CD3B5C0-63AC-404B-8F35-9A506180E1FA@fastcrypt.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Wed, 15 Nov 2006 08:27:26 -0800 Message-Id: <1163608046.8021.6.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27.rhel4.6) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.534 tagged_above=0 required=5 tests=BAYES_20, INFO_TLD, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200611/77 X-Sequence-Number: 16119 I know that the driver is sending unknown as the timestamp type on purpose, but I thought that the back-end was smart enough to associate an unknown-type function parameter with the correct signature. I haven't tested that, but it seems like it should work. But it is known not to work if there is another function with the same name and number of parameters, because the back-end has no means of determining which of the functions should be called. -- Mark On Wed, 2006-11-15 at 11:08 -0500, Dave Cramer wrote: > Mark, > > It is a known "feature/bug". The driver is doing this on purpose. > > see my previous email > > Dave > On 15-Nov-06, at 9:47 AM, Mark Lewis wrote: > > > You don't happen to have another function called donothing which > > takes a > > single parameter of a different type, do you? > > > > -- Mark > > > > On Tue, 2006-11-14 at 22:05 -0600, Reuben Pasquini wrote: > >> Hello! > >> > >> It appears that CallableStatement.setTimestamp() > >> does not work correctly with the latest 8.1 jdbc driver - > >> I've listed a test case below - > >> sorry if this bug is already known. > >> Let me know if you have any questions. > >> Thanks for all the great work. > >> > >> Reuben > >> > >> -------------------- > >> > >> p-nut:/tmp pasquini$ javac Frick.java > >> > >> p-nut:/tmp pasquini$ java -cp postgresql-8.1-407.jdbc3.jar:. Frick > >> Nov 14, 2006 9:59:54 PM Frick main > >> INFO: Caught: org.postgresql.util.PSQLException: ERROR: function > >> donothing("unknown") does not exist > >> > >> > >> p-nut:/tmp pasquini$ cat Frick.java > >> import java.util.*; > >> import java.util.logging.Logger; > >> import java.util.logging.Level; > >> import java.lang.reflect.*; > >> import java.sql.*; > >> > >> /* ............. > >> CREATE OR REPLACE FUNCTION doNothing ( TIMESTAMP ) > >> RETURNS INTEGER AS $FUNC$ > >> BEGIN > >> RETURN 0; > >> END; $FUNC$ > >> LANGUAGE plpgsql; > >> */ > >> > >> /** > >> * Test postgres JDBC setTimestamp functionality against doNothing() > >> */ > >> public class Frick { > >> > >> public static void main ( String[] v_argv ) { > >> Logger log_generic = Logger.getLogger ( "littleware" ); > >> > >> try { > >> Class.forName ( "org.postgresql.Driver" ); > >> Connection sql_conn = DriverManager.getConnection > >> ( "jdbc:postgresql:littleware://localhost:5432", "littleware_user", > >> "" ); > >> CallableStatement sql_call = sql_conn.prepareCall ( "{ ? > >> = call doNothing ( ? ) }" ); > >> java.util.Date t_now = new java.util.Date (); > >> sql_call.registerOutParameter ( 1, Types.INTEGER ); > >> sql_call.setTimestamp ( 2, new Timestamp ( t_now.getTime > >> () ) ); > >> sql_call.execute (); > >> } catch ( Exception e ) { > >> log_generic.log ( Level.INFO, "Caught: " + e ); > >> } > >> } > >> } > >> > >> > >> ---------------------------(end of > >> broadcast)--------------------------- > >> TIP 6: explain analyze is your friend > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 5: don't forget to increase your free space map settings > > >