Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Matthias3
Posts: 8
Joined: Tue 22 May 2012 15:10

Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Matthias3 » Tue 22 May 2012 16:34

Hello,

my application reads timestamp values using DbCommand.ExecuteReader. The returned DateTime values have Kind = DateTimeKind.Local. Is this intent? IMHO, this is not quite correct, as there is no timezone information in the database columns. All other providers I can think of (SQLClient, Oracle data provider, Npgsql...) set Kind to Unspecified.

Thanks!

P.S.: I see in the release notes that this behavior was changed in the most recent version (350). But why?

Matthias3
Posts: 8
Joined: Tue 22 May 2012 15:10

Re: Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Matthias3 » Fri 25 May 2012 07:13

Are there any comments on this issue?
Changing this behavior in the provider is critical in my opinion. E.g. when the application code creates a DateTimeOffset from the read DateTime value, the DateTimeOffset value depends on the Kind of the DateTime value. Therefore, changing the behavior may break applications.
Thanks!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Shalex » Fri 25 May 2012 15:06

We have reproduced the issue when Devart.Data.PostgreSql.PgSqlDataReader.GetDateTime method returns DateTime with DateTimeKind.Local when reading from the timestamp without time zone column. We will correct this behaviour: DateTimeKind.Local -> DateTimeKind.Unspecified.

Matthias3
Posts: 8
Joined: Tue 22 May 2012 15:10

Re: Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Matthias3 » Tue 29 May 2012 12:10

Pleased to hear that.

Regards,

Matthias

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Shalex » Tue 29 May 2012 13:23

The bug with returning DateTime with DateTimeKind.Unspecified by PgSqlDataReader.GetDateTime method when reading from the timestamp without time zone column is fixed. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Reading timestamp: DateTime.Kind = DateTimeKind.Local?

Post by Shalex » Fri 08 Jun 2012 15:50

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

Post Reply