Timestamp bug?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
LukaszGorzynski3
Posts: 2
Joined: Wed 25 Nov 2020 07:28

Timestamp bug?

Post by LukaszGorzynski3 » Wed 25 Nov 2020 07:49

Hi All,

Due to one of our customers, we had to upgrade to 9.13.1127 due to a bug with Oracle RAC connect in direct mode.
Unfortunately the update caused a bug with one particular timestamp (only in direct mode).

timestamp example used:

Code: Select all

TIMESTAMP '1999-12-31 23:59:59.199999 America/Indiana/Indianapolis'
Result without direct mode
Image

Result in direct mode
Image


I would like to know if this is a bug, and if it is, can it be repaired?
Best regards

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

Re: Timestamp bug?

Post by Shalex » Sat 28 Nov 2020 18:12

Could you tell us how we should modify this code to reproduce the issue in our environment?

Code: Select all

    string connString = "User Id=scott;Password=tiger;Server=192.168.10.41/orclpdb;";

    using (var conn = new OracleConnection())
    {
        conn.ConnectionString = connString + "Direct=false;Home=OraClient19Home1;";
        conn.Open();
        var cmd = conn.CreateCommand();

        try
        {
            cmd.CommandText = "drop table F44249";
            cmd.ExecuteNonQuery();
        }
        catch { }

        cmd.CommandText = "CREATE TABLE F44249 (ID NUMBER(10) PRIMARY KEY, TSCOLUMN TIMESTAMP(6) WITH TIME ZONE)";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "INSERT INTO F44249(ID, TSCOLUMN) VALUES (1, :p)";
        cmd.Parameters.Add("p", OracleDbType.TimeStampTZ).Value = new DateTimeOffset(1999, 12, 31, 23, 59, 59, 199, new TimeSpan(-5,0,0));
        cmd.ExecuteNonQuery();
    }

    using (var conn = new OracleConnection())
    {
        conn.ConnectionString = connString + "Direct=false;Home=OraClient19Home1;";
        conn.Open();
        var cmd = conn.CreateCommand();
        cmd.CommandText = "select TSCOLUMN from F44249 where ID=1";
        var reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            DateTimeOffset result = reader.GetDateTimeOffset("TSCOLUMN");
            Console.WriteLine("OCI: {0}", result);
        }
    }

    using (var conn = new OracleConnection())
    {
        conn.ConnectionString = connString + "Direct=true;";
        conn.Open();
        var cmd = conn.CreateCommand();
        cmd.CommandText = "select TSCOLUMN from F44249 where ID=1";
        var reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            DateTimeOffset result = reader.GetDateTimeOffset("TSCOLUMN");
            Console.WriteLine("Direct: {0}", result);
        }
    }
}
Our output is:
OCI: 31.12.1999 23:59:59 -05:00
Direct: 31.12.1999 23:59:59 -05:00

LukaszGorzynski3
Posts: 2
Joined: Wed 25 Nov 2020 07:28

Re: Timestamp bug?

Post by LukaszGorzynski3 » Mon 30 Nov 2020 10:44

Thanks for response,


What I see you are using a specific method (GetDateTimeOffset) in this example to get datatime / timestamp and you pass the column name as argument.

Exact example of the oracle script

Code: Select all

CREATE TABLE OC_LUKASZ_A.timestamp_table(
key_col number PRIMARY KEY,
tz_col TIMESTAMP WITH TIME ZONE);

INSERT INTO OC_LUKASZ_A.timestamp_table VALUES (9,
TIMESTAMP '1999-12-31 23:59:59.199999 America/Indiana/Indianapolis');
We have a different solution (version 9.13.1127 direct mode) -
Image

Image

Image

(version 9.13.1127 OCI )
Image

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

Re: Timestamp bug?

Post by Shalex » Sat 12 Dec 2020 13:53

We have reproduced the issue and will notify you when it is fixed.

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

Re: Timestamp bug?

Post by Shalex » Thu 17 Dec 2020 22:26

The bug with retrieving the TIMESTAMP WITH LOCAL TIME ZONE values in the TZR (time zone region) format in the Direct mode is fixed in v9.14.1160: viewtopic.php?f=1&t=44320.

Post Reply