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

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".

Re: BUG #1611: reading a date-field by "ResultSet.getTimestamp()"

From
Oliver Jowett
Date:
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

Re: BUG #1611: reading a date-field by "ResultSet.getTimestamp()"

From
Kris Jurka
Date:
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
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 whi=
ch
> > 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=3D=3D1.=
 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=3D=3DPostgreSQL: problem!
dCal=3D=3Djava.util.GregorianCalendar[time=3D1114120800000,areFieldsSet=3Dt=
rue,areAllFieldsSet=3Dtrue,lenient=3Dtrue,zone=3Dsun.util.calendar.ZoneInfo=
[id=3D"Europe/Berlin",offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dt=
rue,transitions=3D143,lastRule=3Djava.util.SimpleTimeZone[id=3DEurope/Berli=
n,offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dtrue,startYear=3D0,st=
artMode=3D2,startMonth=3D2,startDay=3D-1,startDayOfWeek=3D1,startTime=3D360=
0000,startTimeMode=3D2,endMode=3D2,endMonth=3D9,endDay=3D-1,endDayOfWeek=3D=
1,endTime=3D3600000,endTimeMode=3D2]],firstDayOfWeek=3D2,minimalDaysInFirst=
Week=3D4,ERA=3D1,YEAR=3D2005,MONTH=3D3,WEEK_OF_YEAR=3D16,WEEK_OF_MONTH=3D3,=
DAY_OF_MONTH=3D22,DAY_OF_YEAR=3D112,DAY_OF_WEEK=3D6,DAY_OF_WEEK_IN_MONTH=3D=
4,AM_PM=3D0,HOUR=3D0,HOUR_OF_DAY=3D0,MINUTE=3D0,SECOND=3D0,MILLISECOND=3D0,=
ZONE_OFFSET=3D3600000,DST_OFFSET=3D3600000]
tCal=3D=3Djava.util.GregorianCalendar[time=3D1114124400000,areFieldsSet=3Dt=
rue,areAllFieldsSet=3Dtrue,lenient=3Dtrue,zone=3Dsun.util.calendar.ZoneInfo=
[id=3D"Europe/Berlin",offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dt=
rue,transitions=3D143,lastRule=3Djava.util.SimpleTimeZone[id=3DEurope/Berli=
n,offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dtrue,startYear=3D0,st=
artMode=3D2,startMonth=3D2,startDay=3D-1,startDayOfWeek=3D1,startTime=3D360=
0000,startTimeMode=3D2,endMode=3D2,endMonth=3D9,endDay=3D-1,endDayOfWeek=3D=
1,endTime=3D3600000,endTimeMode=3D2]],firstDayOfWeek=3D2,minimalDaysInFirst=
Week=3D4,ERA=3D1,YEAR=3D2005,MONTH=3D3,WEEK_OF_YEAR=3D16,WEEK_OF_MONTH=3D3,=
DAY_OF_MONTH=3D22,DAY_OF_YEAR=3D112,DAY_OF_WEEK=3D6,DAY_OF_WEEK_IN_MONTH=3D=
4,AM_PM=3D0,HOUR=3D1,HOUR_OF_DAY=3D1,MINUTE=3D0,SECOND=3D0,MILLISECOND=3D0,=
ZONE_OFFSET=3D3600000,DST_OFFSET=3D3600000]
DBMS=3D=3DOracle: no problem!
dCal=3D=3Djava.util.GregorianCalendar[time=3D1114120800000,areFieldsSet=3Dt=
rue,areAllFieldsSet=3Dtrue,lenient=3Dtrue,zone=3Dsun.util.calendar.ZoneInfo=
[id=3D"Europe/Berlin",offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dt=
rue,transitions=3D143,lastRule=3Djava.util.SimpleTimeZone[id=3DEurope/Berli=
n,offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dtrue,startYear=3D0,st=
artMode=3D2,startMonth=3D2,startDay=3D-1,startDayOfWeek=3D1,startTime=3D360=
0000,startTimeMode=3D2,endMode=3D2,endMonth=3D9,endDay=3D-1,endDayOfWeek=3D=
1,endTime=3D3600000,endTimeMode=3D2]],firstDayOfWeek=3D2,minimalDaysInFirst=
Week=3D4,ERA=3D1,YEAR=3D2005,MONTH=3D3,WEEK_OF_YEAR=3D16,WEEK_OF_MONTH=3D3,=
DAY_OF_MONTH=3D22,DAY_OF_YEAR=3D112,DAY_OF_WEEK=3D6,DAY_OF_WEEK_IN_MONTH=3D=
4,AM_PM=3D0,HOUR=3D0,HOUR_OF_DAY=3D0,MINUTE=3D0,SECOND=3D0,MILLISECOND=3D0,=
ZONE_OFFSET=3D3600000,DST_OFFSET=3D3600000]
DBMS=3D=3DIngres: no problem!
dCal=3D=3Djava.util.GregorianCalendar[time=3D1114120800000,areFieldsSet=3Dt=
rue,areAllFieldsSet=3Dtrue,lenient=3Dtrue,zone=3Dsun.util.calendar.ZoneInfo=
[id=3D"Europe/Berlin",offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dt=
rue,transitions=3D143,lastRule=3Djava.util.SimpleTimeZone[id=3DEurope/Berli=
n,offset=3D3600000,dstSavings=3D3600000,useDaylight=3Dtrue,startYear=3D0,st=
artMode=3D2,startMonth=3D2,startDay=3D-1,startDayOfWeek=3D1,startTime=3D360=
0000,startTimeMode=3D2,endMode=3D2,endMonth=3D9,endDay=3D-1,endDayOfWeek=3D=
1,endTime=3D3600000,endTimeMode=3D2]],firstDayOfWeek=3D2,minimalDaysInFirst=
Week=3D4,ERA=3D1,YEAR=3D2005,MONTH=3D3,WEEK_OF_YEAR=3D16,WEEK_OF_MONTH=3D3,=
DAY_OF_MONTH=3D22,DAY_OF_YEAR=3D112,DAY_OF_WEEK=3D6,DAY_OF_WEEK_IN_MONTH=3D=
4,AM_PM=3D0,HOUR=3D0,HOUR_OF_DAY=3D0,MINUTE=3D0,SECOND=3D0,MILLISECOND=3D0,=
ZONE_OFFSET=3D3600000,DST_OFFSET=3D3600000]