Page 1 of 1

Timestamp bug?

Posted: Wed 25 Nov 2020 07:49
by LukaszGorzynski3
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

Re: Timestamp bug?

Posted: Sat 28 Nov 2020 18:12
by Shalex
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

Re: Timestamp bug?

Posted: Mon 30 Nov 2020 10:44
by LukaszGorzynski3
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

Re: Timestamp bug?

Posted: Sat 12 Dec 2020 13:53
by Shalex
We have reproduced the issue and will notify you when it is fixed.

Re: Timestamp bug?

Posted: Thu 17 Dec 2020 22:26
by Shalex
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.