Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-3868

unix_timestamp() output incorrect when time_zone is not 0:00

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Do
    • 1.4.3
    • 1.4.5
    • PrimProc
    • None

    Description

      The unix_timestamp() function is not using the current time_zone variable value for calculations, when this value is non-zero. Here are steps to reproduce:

      MariaDB [test]> create table i1 (a date, b date);
      Query OK, 0 rows affected (0.025 sec)
       
      MariaDB [test]> insert into i1 values ('2009-07-04', '1980-01-01');
      Query OK, 1 row affected (0.001 sec)
       
      MariaDB [test]> create table c1 (a date, b date)engine=columnstore;
      Query OK, 0 rows affected (1.548 sec)
       
      MariaDB [test]> insert into c1 values ('2009-07-04', '1980-01-01');
      Query OK, 1 row affected (0.227 sec)
       
      MariaDB [test]> set time_zone='+0:00';
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from i1;
      +------------+------------+-------------------+-------------------+
      | a          | b          | unix_timestamp(a) | unix_timestamp(b) |
      +------------+------------+-------------------+-------------------+
      | 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
      +------------+------------+-------------------+-------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from c1;
      +------------+------------+-------------------+-------------------+
      | a          | b          | unix_timestamp(a) | unix_timestamp(b) |
      +------------+------------+-------------------+-------------------+
      | 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
      +------------+------------+-------------------+-------------------+
      1 row in set (0.040 sec)
       
      MariaDB [test]> set time_zone='-5:00';
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from i1;
      +------------+------------+-------------------+-------------------+
      | a          | b          | unix_timestamp(a) | unix_timestamp(b) |
      +------------+------------+-------------------+-------------------+
      | 2009-07-04 | 1980-01-01 |        1246683600 |         315550800 |
      +------------+------------+-------------------+-------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> select a, b, unix_timestamp(a), unix_timestamp(b) from c1;
      +------------+------------+-------------------+-------------------+
      | a          | b          | unix_timestamp(a) | unix_timestamp(b) |
      +------------+------------+-------------------+-------------------+
      | 2009-07-04 | 1980-01-01 |        1246665600 |         315532800 |
      +------------+------------+-------------------+-------------------+
      1 row in set (0.008 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              tntnatbry Gagan Goel (Inactive)
              tntnatbry Gagan Goel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.