X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 778F6D99A4 for ; Fri, 4 Nov 2005 21:35:04 -0400 (AST) 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 78223-04 for ; Sat, 5 Nov 2005 01:35:01 +0000 (GMT) X-Greylist: delayed 03:14:44.114204 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id CD195D680C for ; Fri, 4 Nov 2005 21:35:02 -0400 (AST) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr2.postgresql.org (Postfix) with ESMTP id 2B3A7F14F9 for ; Fri, 4 Nov 2005 22:20:19 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EY9uv-0000sA-FR; Sat, 05 Nov 2005 11:20:13 +1300 Message-ID: <436BDE93.8090308@opencloud.com> Date: Sat, 05 Nov 2005 11:20:03 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Eli=E9zer_Madeira_de_Campos?= Cc: pgsql-jdbc@postgresql.org Subject: Re: 7.3 -> 8.0.4 migration timestamp problem References: <54CC7CADE26E884EB2BCEC863F5C1F70F9D263@moscou.diuno.net> In-Reply-To: <54CC7CADE26E884EB2BCEC863F5C1F70F9D263@moscou.diuno.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/21 X-Sequence-Number: 14119 Eliézer Madeira de Campos wrote: > The date stored in database is actually 1912-12-31 23:53:12.0 (however it should have stored 1913-01-01. > > I have already debugged the Postgres-8.0 (build 313) driver and it seems to send the correct date to database. What type is the target column you are inserting into? > Timestamp ts = new Timestamp(c.getTimeInMillis()); > pst = con.prepareStatement("select date_trunc('day', TIMESTAMP ?)"); > pst.setObject(1, ts); Use "CAST (? AS TIMESTAMP)" instead of "TIMESTAMP ?". -O