Daylight savings bug

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
mpearse
Posts: 9
Joined: Mon 02 Feb 2015 00:00

Daylight savings bug

Post by mpearse » Tue 06 Oct 2015 00:52

Hi,

We are experiencing a bug in the dotConnect provider for Postgresql (7.3.X , though I have tested a trial of latest as well).

Example scenario:
1. Set host to Australian Eastern Standard Time.

2. Insert a record on the day daylight savings had switched on, which here this year was Sunday Oct 4.
i.e. cmd.CommandText = "INSERT INTO \"MyTable\" (\"MyDate\") VALUES ('2015-10-04 08:24:15+11')";
(daylight savings here is +11, while standard time is +10).

3. Retrieve the date from the db.... i.e. something like
using (var cmd = new PgSqlCommand())
{
cmd.Connection = _pgConn;
cmd.CommandText = "SELECT \"MyDate\" FROM \"MyTable\"";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
dateReturned = reader.GetDateTime(0);
}
}
}

Assert.That(dateReturned, Is.EqualTo(DateTime.Parse("2015-10-04 08:24:15+11")));
//Fails! Expected: 2015-10-04 08:24:15.000 But was: 2015-10-04 07:24:15.000

It has treated the date like it was before DST when moving it back to local.

I have a nunit test reproducing the issue if you need. This is impacting a production system for us. The same test works fine in npgsql.

The problem only occurs on the date daylight savings was switched on or off, only when the timezone of the machine is set locally (I've only tested AEST, but suspect it is general issue), and not for the full day (I think when the date in UTC falls onto the same date here, the problem stops).

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Daylight savings bug

Post by Pinturiccio » Thu 08 Oct 2015 09:35

We have reproduced the issue. We will investigate it and post here about the results as soon as possible.

mpearse
Posts: 9
Joined: Mon 02 Feb 2015 00:00

Re: Daylight savings bug

Post by mpearse » Fri 09 Oct 2015 00:17

Great thank you

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Daylight savings bug

Post by Pinturiccio » Mon 19 Oct 2015 13:38

We have fixed the bug with calculating a time zone in a day when the clock is set to winter or summer time. We will notify you when the corresponding build of dotConnect for PostgreSQL is available for download.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Daylight savings bug

Post by Pinturiccio » Fri 23 Oct 2015 08:39

New build of dotConnect for PostgreSQL 7.4.521 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=32677

mpearse
Posts: 9
Joined: Mon 02 Feb 2015 00:00

Re: Daylight savings bug

Post by mpearse » Tue 27 Oct 2015 03:23

Great my unit test now passes, thanks!

Post Reply