Re: 7.3 -> 8.0.4 migration timestamp problem

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Eliézer Madeira de Campos <eliezer(at)diuno(dot)com(dot)br>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: 7.3 -> 8.0.4 migration timestamp problem
Date: 2005-11-04 22:20:03
Message-ID: 436BDE93.8090308@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Eliézer Madeira de Campos 2005-11-04 22:39:12 Re: 7.3 -> 8.0.4 migration timestamp problem
Previous Message Eliézer Madeira de Campos 2005-11-04 18:35:34 7.3 -> 8.0.4 migration timestamp problem