Re: 7.3 -> 8.0.4 migration timestamp problem - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: 7.3 -> 8.0.4 migration timestamp problem
Date
Msg-id 436BDE93.8090308@opencloud.com
Whole thread Raw
In response to 7.3 -> 8.0.4 migration timestamp problem  (Eliézer Madeira de Campos <eliezer@diuno.com.br>)
List 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


pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: 7.3 -> 8.0.4 migration timestamp problem
Next
From: pavi thra
Date:
Subject: doubt