X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4BF0B9FAC76 for ; Wed, 28 Jun 2006 19:46:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 43535-03 for ; Wed, 28 Jun 2006 19:46:06 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web32014.mail.mud.yahoo.com (web32014.mail.mud.yahoo.com [68.142.207.111]) by postgresql.org (Postfix) with SMTP id 741159FA999 for ; Wed, 28 Jun 2006 19:46:06 -0300 (ADT) Received: (qmail 94633 invoked by uid 60001); 28 Jun 2006 22:46:05 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=OgFMPuCgyDx5NbFZoybTUwkNr2QDlI+0t4e4jNBvpUuY9Lgi1b+2i74y+BzMMTOnLB5z+M5VMGDlG7c6hQrQidnXDJvV1r3IgwbtO90Gsontq7W0+hgUvupQwt+5cNJjkFCK2XHznSs4L+987YZi4tNl2+2u7hipOFB0+er3ap8= ; Message-ID: <20060628224605.94631.qmail@web32014.mail.mud.yahoo.com> Received: from [130.91.228.144] by web32014.mail.mud.yahoo.com via HTTP; Wed, 28 Jun 2006 15:46:05 PDT Date: Wed, 28 Jun 2006 15:46:05 -0700 (PDT) From: "j.random.programmer" Subject: Possible to say: [setObject("123")] to insert into int column type ? To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/132 X-Sequence-Number: 15412 Hi: I think setObject() has been discussed extensively on this list (particularly with setting null values). However, consider the following: In PSQL: test=# create table foo (number_column int); Now in Java: PreparedStatement ps = con.prepareStatement( "insert into foo (number_column) values (?)" ); ps.setObject(1, "123"); ps.executeUpdate(); This will throw a Driver exception. Is this expected behavior or should the driver do a Integer.parseInt(...) on the string value as needed ? This is not a show-stopper or even a serious bug in my code and is easy to workaround. I'm just curious as to the "right" behavior as per the JDBC spec..... Best regards, --j ----------------------- Exception ------------------ ERROR: column "number_column" is of type integer but expression is of type character varying at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse( QueryExecutorImpl.java:1527) at org.postgresql.core.v3.QueryExecutorImpl.processResults( QueryExecutorImpl.java:1311) ..... --------------------------------------------------- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com