X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 34A3053694 for ; Mon, 11 Apr 2005 09:40:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03373-03 for ; Mon, 11 Apr 2005 12:39:56 +0000 (GMT) Received: from mail2.il.mainsoft.com (mail2.il.mainsoft.com [213.31.213.13]) by svr1.postgresql.org (Postfix) with ESMTP id 3B85F5369B for ; Mon, 11 Apr 2005 09:39:55 -0300 (ADT) Received: from [172.17.1.58] (BORISK-XP.il.mainsoft.com [172.17.1.58]) by mail2.il.mainsoft.com (8.12.10/8.12.10) with ESMTP id j3BCdvjW005791 for ; Mon, 11 Apr 2005 15:39:57 +0300 Message-ID: <425A701C.6070608@mainsoft.com> Date: Mon, 11 Apr 2005 15:39:56 +0300 From: Boris Kirzner User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Bug in storing Timestamp Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/66 X-Sequence-Number: 12673 Short description : Storing java.sql.Timestamp with specified milliseconds value results to wrong value stored in db. System details : OS : WindowsXP PostgreSQL version : 8.0.1 Driver version : 8.0 build 310 Detailed description : In order to reproduce the bug run the following code. Create the table in the db. The code creates a timestamp of "0001-01-01 02:02:02.0" and stores it into the db. The actual value stored is "02:22:42". CREATE TABLE TYPES_EXTENDED ( id char(10), t_time time ) WITHOUT OIDS; long milliseconds = Timestamp.valueOf("0001-01-01 02:02:02.0").getTime(); Timestamp javaTimestamp = new Timestamp(milliseconds); System.out.println("Timestamp stored : " + javaTimestamp); PreparedStatement stmt = connection.prepareStatement("insert into types_extended(ID,t_time) values ('aaa',?)"); stmt.setTimestamp(1, javaTimestamp); stmt.execute(); Thank you in advance, -- Boris Kirzner Mainsoft Corporation http://www.mainsoft.com