pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eliézer Madeira de Campos <eliezer@diuno.com.br>
To: pgsql-jdbc@postgresql.org
Subject: Re: 7.3 -> 8.0.4 migration timestamp problem
Date: Fri, 4 Nov 2005 20:39:12 -0200
Message-ID: <54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net> (raw)

 


-----Original Message-----
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: sexta-feira, 4 de novembro de 2005 20:20
To: Eliézer Madeira de Campos
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] 7.3 -> 8.0.4 migration timestamp problem

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 without timezone.

>>       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 ?".
Why should I, if "TIMESTAMP ?" works when I run the insert in psql (or via unprepared statement)?
That might be valid as a workaround, but it would cost me thousands changes in the application, so it's not really a solution to the problem.

Eliézer M de Campos



view thread (5+ messages)  latest in thread

Message-ID: <54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net>
Permalink:  ../54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net/
Also on:    postgresql.org/message-id/54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: eliezer@diuno.com.br
  Subject: Re: 7.3 -> 8.0.4 migration timestamp problem
  In-Reply-To: <54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net>
  References: <54CC7CADE26E884EB2BCEC863F5C1F70F9D282@moscou.diuno.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox