JDBC/TIMESTAMP/infnity question

From: "Moran, William" <William(dot)Moran(at)intermedix(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC/TIMESTAMP/infnity question
Date: 2014-03-02 17:31:01
Message-ID: 4D557EC7CC2A544AA7C1A3B9CBA2B36724E70E5374@exchange03.epbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Working with the JDBC driver and PostgreSQL TIMESAMP types, I've
observed the following behavior, which is odd to me:

getString('infinity'::timestamp) = "infinity"
getString('-infinity'::timestamp) = "-infinity"
getTimestamp('infinity'::timestamp) = 292278994-08-16 18:00:00.0
getTimestamp('-infinity'::timestamp) = 292269055-12-02 18:00:00.0

As best as my research can tell, the java.sql.Timestamp type doesn't
have any concept of infinity/-infinity. But I'm surprised -infinity
is converted into a date far in the future instead of something in the
past.

Looking through the source code, it looks like the driver is trying to
do the best it can by picking a large date in the past ... does anyone
know why it's ending up in the future?

Bill Moran, System Architect
Phone: 412-422-3463x4023
http://www.intermedix.com

The information contained in this message is confidential and may be
privileged and/or protected under law. If you received this message in
error, please notify us immediately by forwarding a copy to
compliance(at)intermedix(dot)com and then deleting the original message and
any attachments.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Artem Pronchakov 2014-03-06 08:07:21 insert daterange field value
Previous Message Guillaume Smet 2014-02-26 18:08:06 Re: pgjdbc-ng