Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19829

CURRENT_TIMESTAMP produces zeros via trigger

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • 5.5, 10.0, 10.1
    • N/A
    • Triggers
    • None

    Description

      This already reported upstream https://bugs.mysql.com/bug.php?id=84077
      I can repeat this issue on MariaDB Server 10.1.19 however this doesn't exists in 10.2 and 10.3

      +-------------------------+------------------+
      | Variable_name           | Value            |
      +-------------------------+------------------+
      | innodb_version          | 5.6.32-79.0      |
      | protocol_version        | 10               |
      | slave_type_conversions  |                  |
      | version                 | 10.1.19-MariaDB  |
      | version_comment         | MariaDB Server   |
      | version_compile_machine | x86_64           |
      | version_compile_os      | Linux            |
      | version_malloc_library  | bundled jemalloc |
      | version_ssl_library     | YaSSL 2.4.2      |
      | wsrep_patch_version     | wsrep_25.16      |
      +-------------------------+------------------+
      10 rows in set (0.00 sec)
       
      CREATE TABLE tbl(
      a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
      b INT NOT NULL DEFAULT '123');
       
      CREATE TABLE tbl2(
      c TIMESTAMP NOT NULL);
       
      DELIMITER $
      CREATE TRIGGER tbl_before_insert BEFORE INSERT ON tbl FOR EACH ROW
      BEGIN
      SET @a = NEW.a;
      SET @b = NEW.b;
      INSERT INTO tbl2(c) VALUES(NEW.a);
      END;$
       
      DELIMITER ;
      INSERT INTO tbl VALUES ();
       
      mysql [localhost:10119] {msandbox} (test) > INSERT INTO tbl1 VALUES ();
      Query OK, 1 row affected (0.01 sec)
       
      mysql [localhost:10119] {msandbox} (test) > SELECT * FROM tbl1;
      +---------------------+-----+
      | a                   | b   |
      +---------------------+-----+
      | 2019-06-21 15:11:05 | 123 |
      +---------------------+-----+
      1 row in set (0.00 sec)
       
      mysql [localhost:10119] {msandbox} (test) > SELECT * FROM tbl2;
      +---------------------+
      | c                   |
      +---------------------+
      | 0000-00-00 00:00:00 |
      +---------------------+
      1 row in set (0.00 sec)
       
      mysql [localhost:10119] {msandbox} (test) > SELECT @a, @b;
      +---------------------+------+
      | @a                  | @b   |
      +---------------------+------+
      | 0000-00-00 00:00:00 |  123 |
      +---------------------+------+
      1 row in set (0.00 sec)
      

      column 'c' contains non-zero date time value.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            muhammad.irfan Muhammad Irfan
            Votes:
            0 Vote for this issue
            Watchers:
            6 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.