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

Trigger prevents insert after update to 10.1.21-MariaDB-1~trusty

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.1.21
    • 10.1.22, 10.2.5
    • Server, Triggers
    • None
    • Ubuntu Trusty 14.04LTS
    • 10.1.22

    Description

      After upgrading to the latest version from repository (apt-get update && apt-get upgrade), I can no longer insert into tables that have a trigger.

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 211
      Server version: 10.1.21-MariaDB-1~trusty mariadb.org binary distribution
       
      Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> use devdb;
       
      MariaDB [devdb]> drop trigger token_user;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [devdb]> insert into user (email) values ("junk1@r.com");
      Query OK, 1 row affected, 4 warnings (0.01 sec)
      

      MariaDB [devdb]> describe user;
      | Field                    | Type             | Null | Key | Default             | Extra          |
      | user_id                  | int(10) unsigned | NO   | PRI | NULL                | auto_increment |
      | created                  | timestamp        | YES  |     | CURRENT_TIMESTAMP   |                |
      | token                    | varchar(255)     | YES  |     |                     |                |
      ... There are 69 other rows ....
      72 rows in set (0.00 sec)
       
      MariaDB [devdb]> update user set token = SHA1(RAND()) where user_id = last_insert_id();
      Query OK, 1 row affected, 1 warning (0.00 sec)
      Rows matched: 1  Changed: 1  Warnings: 1
      

      MariaDB [devdb]> DELIMITER ;;
      MariaDB [devdb]> CREATE TRIGGER token_user
          -> BEFORE INSERT ON user
          -> FOR EACH ROW
          -> BEGIN
          -> SET NEW.token = SHA1(RAND());
          -> END ;;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [devdb]> DELIMITER ;
      MariaDB [devdb]> 
      MariaDB [devdb]> insert into user (email) values ("junk2@r.com");
      Query OK, 0 rows affected (0.00 sec)
      

      MariaDB [devdb]> drop trigger token_user;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [devdb]> insert into user (email) values ("junk2@r.com");
      Query OK, 1 row affected, 4 warnings (0.00 sec)
       
      The warnings don't appear relevant as they were there before:
       
      MariaDB [devdb]> show warnings;
      +---------+------+-------------------------------------------------------+
      | Level   | Code | Message                                               |
      +---------+------+-------------------------------------------------------+
      | Warning | 1364 | Field 'store' doesn't have a default value            |
      | Warning | 1364 | Field 'expiration_date' doesn't have a default value  |
      | Warning | 1364 | Field 'scope' doesn't have a default value            |
      | Warning | 1364 | Field 'type' doesn't have a default value |
      +---------+------+-------------------------------------------------------+
      4 rows in set (0.00 sec)
      

      Attachments

        Issue Links

          Activity

            The warnings are the problem. This wasn't enforced in this manner in the previous version. I gave the columns default values and it went away.

            resultsathand Jonathan Brown added a comment - The warnings are the problem. This wasn't enforced in this manner in the previous version. I gave the columns default values and it went away.

            Thanks for the report, we have a similar one already, MDEV-11842.

            elenst Elena Stepanova added a comment - Thanks for the report, we have a similar one already, MDEV-11842 .
            jan.reges Ján Regeš added a comment -

            Hi,

            this is very insidious bug After yesterday's upgrade from 10.1.20 to 10.1.21, our e-shop works (at first look), but it was not possible to insert orders or
            purchases on stores for 12 hours After downgrade it works again.

            jan.reges Ján Regeš added a comment - Hi, this is very insidious bug After yesterday's upgrade from 10.1.20 to 10.1.21, our e-shop works (at first look), but it was not possible to insert orders or purchases on stores for 12 hours After downgrade it works again.
            jan.reges Ján Regeš added a comment -

            Could be this fatal issue added to issues that needs to be fixed in 10.1.22? (https://jira.mariadb.org/projects/MDEV/versions/22502)

            Thank you.

            jan.reges Ján Regeš added a comment - Could be this fatal issue added to issues that needs to be fixed in 10.1.22? ( https://jira.mariadb.org/projects/MDEV/versions/22502 ) Thank you.

            jan.reges,
            it will be fixed in 10.1.22. The original report, MDEV-11842, has already been set to be a 'Blocker', which means just that.

            elenst Elena Stepanova added a comment - jan.reges , it will be fixed in 10.1.22. The original report, MDEV-11842 , has already been set to be a 'Blocker', which means just that.
            jan.reges Ján Regeš added a comment -

            Elena Stepanova, thank you

            jan.reges Ján Regeš added a comment - Elena Stepanova, thank you

            People

              serg Sergei Golubchik
              resultsathand Jonathan Brown
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.