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

Wrong result for row comparison of trigger NEW/OLD: NEW = OLD returns 1 after a column change, OLD = (1,2,3) returns 0

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Triggers
    • None
    • Not for Release Notes
    • Q4/2026 Server Development

    Description

      CREATE TABLE t1 (a INT, b INT, c INT);
      INSERT INTO t1 VALUES (1,2,3);
      CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW  SET @r = CONCAT_WS(',', NEW = OLD, OLD = (1,2,3));
      UPDATE t1 SET b = 20;
      SELECT @r;   -- got 1,0   expected 0,1
      

      13.2.0-dbg>CREATE TABLE t1 (a INT, b INT, c INT);
      Query OK, 0 rows affected (0.009 sec)
       
      13.2.0-dbg>INSERT INTO t1 VALUES (1,2,3);
      Query OK, 1 row affected (0.001 sec)
       
      13.2.0-dbg>CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @r = CONCAT_WS(',', NEW = OLD, OLD = (1,2,3));
      Query OK, 0 rows affected (0.006 sec)
       
      13.2.0-dbg>UPDATE t1 SET b = 20;
      Query OK, 1 row affected (0.003 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      13.2.0-dbg>SELECT @r;           
      +------+
      | @r   |
      +------+
      | 1,0  |
      +------+
      1 row in set (0.000 sec)
       
      13.2.0-dbg>
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              ramesh Ramesh Sivaraman
              Ramesh Sivaraman Ramesh Sivaraman
              Dmitry Shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.5h Remaining Estimate - 2d
                  2d
                  Logged:
                  Time Spent - 0.5h Remaining Estimate - 2d
                  0.5h

                  Git Integration

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