Daylight saving time rules being applied to DateTimes that don't have a timezone - Mailing list pgsql-odbc

From Nathan Kendall
Subject Daylight saving time rules being applied to DateTimes that don't have a timezone
Date
Msg-id CAOvUx4=JrsBR34FVjWrLTkNc0ripMo=k9m-_naXH0SwG4YM9bg@mail.gmail.com
Whole thread Raw
Responses Re: Daylight saving time rules being applied to DateTimes that don't have a timezone  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-odbc
We are having a problem with psqlODBC versions 09.05.0100 through
09.05.0400.  With the database table schema listed below, the sample
C# test app below that fails with a violation of the primary key.
However, the same C# code works without issue when using psqlODBC
version 09.03.0400 or older.  It would seem as though psqlODBC
versions from 09.05.0100 onward are applying daylight saving time
rules to DateTimes that are specified as not being associated with a
timezone.

Nathan


CREATE TABLE time_test
(
  stationid character varying(8) NOT NULL,
  date_time timestamp without time zone NOT NULL,
  temperature double precision,
  CONSTRAINT time_test_pk PRIMARY KEY (stationid, date_time)
);


C# Test App Source Code:

using System;
using System.Data.Odbc;

namespace TimeTestApp1
{
  class Program
  {
    static void Main(string[] args)
    {
      using (var conn = new OdbcConnection("Driver={PostgreSQL
ANSI(x64)};Server=localhost;Database=weather;Uid=userGoesHere;Pwd=passGoesHere;"))
      {
        conn.Open();
        using (var command = new OdbcCommand("", conn))
        {
          command.Parameters.Add(new OdbcParameter("stationid",
OdbcType.VarChar));
          command.Parameters.Add(new OdbcParameter("date_time",
OdbcType.DateTime));
          command.Parameters.Add(new OdbcParameter("temperature",
OdbcType.Double));
          command.CommandText = "INSERT INTO time_test (stationid,
date_time, temperature) VALUES (?, ?, ?)";
          command.CommandTimeout = 60;
          command.Prepare();

          DateTime[] testTimes = new DateTime[] {
            new DateTime(2016, 3, 13, 1, 0, 0, DateTimeKind.Unspecified),
            new DateTime(2016, 3, 13, 2, 0, 0, DateTimeKind.Unspecified),
            new DateTime(2016, 3, 13, 3, 0, 0, DateTimeKind.Unspecified)
          };

          int i = 0;
          foreach (var dt in testTimes)
          {
            i++;
            command.Parameters[0].Value = "Place";
            command.Parameters[1].Value = dt;
            command.Parameters[2].Value = 60 - i;
            command.ExecuteNonQuery();
          }
        }
      }
    }
  }
}


pgsql-odbc by date:

Previous
From: "Arnaud L."
Date:
Subject: Re: Problem in using PostgreSQL ODBC driver with VBA
Next
From: Germán Valdez
Date:
Subject: error conection Provider=MSDASQL