Re: Bug in storing Timestamp - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Bug in storing Timestamp
Date
Msg-id 29958.1113232047@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug in storing Timestamp  ("mikael-aronsson" <mikael-aronsson@telia.com>)
List pgsql-jdbc
"mikael-aronsson" <mikael-aronsson@telia.com> writes:
> I have never had any problems with timestamps, if I remember correct the
> resolution gets worse when you get far away from 1900 or so, is it possible
> that using year 0001 gives that bad resolution maybe ?

Good thought, but no; the error at 0001 is still down around the sixth
decimal place:

regression=# select '0001-01-01 02:02:02.123456'::timestamp;
         timestamp
----------------------------
 0001-01-01 02:02:02.123459
(1 row)

I was wondering about the fact that he was storing into a time column
rather than a timestamp.  That works if the conversion is done on the
server, modulo the sixth decimal place again:

regression=# select '0001-01-01 02:02:02.123456'::timestamp::time;
      time
-----------------
 02:02:02.123459
(1 row)

but maybe it's confusing the JDBC driver into doing the wrong thing
entirely.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: "mikael-aronsson"
Date:
Subject: Re: Bug in storing Timestamp
Next
From: "Joost Kraaijeveld"
Date:
Subject: JBoss, PostgreSQL and XDoclets question