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).
Daylight savings bug
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Daylight savings bug
We have reproduced the issue. We will investigate it and post here about the results as soon as possible.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Daylight savings bug
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.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Daylight savings bug
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
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
Re: Daylight savings bug
Great my unit test now passes, thanks!