BUG #1611: reading a date-field by "ResultSet.getTimestamp()" method analized dayligth flag

Started by Ingolf Knopfabout 21 years ago4 messagesbugs
Jump to latest
#1Ingolf Knopf
iknopf@csc-dd.de

The following bug has been logged online:

Bug reference: 1611
Logged by: Ingolf Knopf
Email address: iknopf@csc-dd.de
PostgreSQL version: 8.0.1
Operating system: JDBC
Description: reading a date-field by "ResultSet.getTimestamp()"
method analized dayligth flag
Details:

Retrieving data by "java.sql.ResultSet" I read a data from a column which
has type DATE. I read content of this column by method
"ResultSet.getTimestamp( int )".
I get a "java.sql.Timestamp"-object, where Calendar.HOUR_OF_DAY==1. I
suppose, this is daylight flag.

Maybe this behavior of your JDBC driver is compatible with SQL standard, but
it is completely other than the behavior of "Oracle" or "Ingres".

#2Oliver Jowett
oliver@opencloud.com
In reply to: Ingolf Knopf (#1)
Re: BUG #1611: reading a date-field by "ResultSet.getTimestamp()"

Ingolf Knopf wrote:

The following bug has been logged online:

Bug reference: 1611
Logged by: Ingolf Knopf
Email address: iknopf@csc-dd.de
PostgreSQL version: 8.0.1
Operating system: JDBC
Description: reading a date-field by "ResultSet.getTimestamp()"
method analized dayligth flag
Details:

Retrieving data by "java.sql.ResultSet" I read a data from a column which
has type DATE. I read content of this column by method
"ResultSet.getTimestamp( int )".
I get a "java.sql.Timestamp"-object, where Calendar.HOUR_OF_DAY==1. I
suppose, this is daylight flag.

Maybe this behavior of your JDBC driver is compatible with SQL standard, but
it is completely other than the behavior of "Oracle" or "Ingres".

Can you provide a compilable test case please?

What is the behaviour of Oracle/Ingres with the same test case?

-O

#3Ingolf Knopf
iknopf@csc-dd.de
In reply to: Oliver Jowett (#2)
Re: BUG #1611: reading a date-field by "ResultSet.getTimestamp()" method analized dayligth flag

Am Donnerstag, 21. April 2005 23:49 schrieben Sie:

Ingolf Knopf wrote:

The following bug has been logged online:

Bug reference: 1611
Logged by: Ingolf Knopf
Email address: iknopf@csc-dd.de
PostgreSQL version: 8.0.1
Operating system: JDBC
Description: reading a date-field by "ResultSet.getTimestamp()"
method analized dayligth flag
Details:

Retrieving data by "java.sql.ResultSet" I read a data from a column which
has type DATE. I read content of this column by method
"ResultSet.getTimestamp( int )".
I get a "java.sql.Timestamp"-object, where Calendar.HOUR_OF_DAY==1. I
suppose, this is daylight flag.

Maybe this behavior of your JDBC driver is compatible with SQL standard,
but it is completely other than the behavior of "Oracle" or "Ingres".

Can you provide a compilable test case please?

What is the behaviour of Oracle/Ingres with the same test case?

-O

See attached file. The problem you can find in method 'run( void )'. Output
of my program is:

DBMS==PostgreSQL: problem!
dCal==java.util.GregorianCalendar[time=1114120800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2005,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=22,DAY_OF_YEAR=112,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
tCal==java.util.GregorianCalendar[time=1114124400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2005,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=22,DAY_OF_YEAR=112,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=1,HOUR_OF_DAY=1,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
DBMS==Oracle: no problem!
dCal==java.util.GregorianCalendar[time=1114120800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2005,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=22,DAY_OF_YEAR=112,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
DBMS==Ingres: no problem!
dCal==java.util.GregorianCalendar[time=1114120800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2005,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=22,DAY_OF_YEAR=112,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]

Attachments:

RsetDemo.javatext/x-java; charset=iso-8859-1; name=RsetDemo.javaDownload
#4Kris Jurka
books@ejurka.com
In reply to: Oliver Jowett (#2)
Re: BUG #1611: reading a date-field by "ResultSet.getTimestamp()"

On Fri, 22 Apr 2005, Oliver Jowett wrote:

Ingolf Knopf wrote:

Bug reference: 1611
PostgreSQL version: 8.0.1
Operating system: JDBC
Description: reading a date-field by "ResultSet.getTimestamp()"
method analized dayligth flag
Details:

Retrieving data by "java.sql.ResultSet" I read a data from a column which
has type DATE. I read content of this column by method
"ResultSet.getTimestamp( int )".
I get a "java.sql.Timestamp"-object, where Calendar.HOUR_OF_DAY==1. I
suppose, this is daylight flag.

Maybe this behavior of your JDBC driver is compatible with SQL standard, but
it is completely other than the behavior of "Oracle" or "Ingres".

Can you provide a compilable test case please?

I wrote this test, but I haven't really thought about what to do with it
yet. For me it shows:

2005-04-20
2005-04-20 16:00:00.0
420
2005-11-20
2005-11-20 16:00:00.0
480

Kris Jurka

Attachments:

DateToTS.javatext/plain; charset=US-ASCII; name=DateToTS.javaDownload