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

DROP TRIGGER command not respecting read_only = 1 setting

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.5.34
    • Fix Version/s: 5.5.37
    • Component/s: Triggers
    • Labels:
    • Environment:
      CentOS 5.10 x86_64

      Description

      (also reported to MySQL here: http://bugs.mysql.com/bug.php?id=71136)

      The "read_only" global variable is not respected by the DROP TRIGGER command, even for a non-SUPER user. It does appear to respect read_only for CREATE TRIGGER. This should return an error, not succeed.

      MariaDB [foo]> select @@version;
      +--------------------+
      | @@version          |
      +--------------------+
      | 5.5.34-MariaDB-log |
      +--------------------+
      1 row in set (0.00 sec)
      
      MariaDB [foo]> select @@read_only;
      +-------------+
      | @@read_only |
      +-------------+
      |           1 |
      +-------------+
      1 row in set (0.00 sec)
      
      MariaDB [foo]> show grants for current_user;
      +--------------------------------------------------------------------------------+
      | Grants for foo@localhost                                                       |
      +--------------------------------------------------------------------------------+
      | GRANT USAGE ON *.* TO 'foo'@'localhost' IDENTIFIED BY PASSWORD 'redacted'      |
      | GRANT SELECT, INSERT, UPDATE, DELETE, TRIGGER ON `foo`.* TO 'foo'@'localhost'  |
      +--------------------------------------------------------------------------------+
      2 rows in set (0.00 sec)
      
      MariaDB [foo]> DROP TRIGGER ins_sum;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [foo]> CREATE TRIGGER ins_sum BEFORE INSERT ON account  FOR EACH ROW SET @sum = @sum + NEW.amount;
      ERROR 1290 (HY000): The MariaDB server is running with the --read-only option so it cannot execute this statement
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            savita Savita Agrawal added a comment -

            A check (lex->sql_command == SQLCOM_DROP_TRIGGER) in function deny_updates_if_read_only_option() in the file sql_parse.cc does the job!
            Is it a right approach? If yes, I will be submitting my first patch to mariadb.

            Show
            savita Savita Agrawal added a comment - A check (lex->sql_command == SQLCOM_DROP_TRIGGER) in function deny_updates_if_read_only_option() in the file sql_parse.cc does the job! Is it a right approach? If yes, I will be submitting my first patch to mariadb.
            Hide
            elenst Elena Stepanova added a comment -

            The upstream bug is private, but the log and tests suggest that it was fixed in 5.5.37:

            revno: 4572
            revision-id: bharathy.x.satish@oracle.com-20140107094105-orxie9xz39mm8esu
            parent: laasya.moduludu@oracle.com-20140106104305-j9iznr6wwpva4ifg
            committer: Bharathy Satish <bharathy.x.satish@oracle.com>
            branch nick: mysql-5.5
            timestamp: Tue 2014-01-07 15:11:05 +0530
            message:
              Bug #17503460 MYSQL READ ONLY DOESN'T WORK FOR DROP TRIGGER
              
              Problem: Drop Trigger succeeds even after setting read_only 
              variable to ON.
              Fix: Fix is to report the standard error 
              (ER_OPTION_PREVENTS_STATEMENT)when global read_only variable 
              is set to ON.
            

            The fix was merged into MariaDB 5.5.37.

            Show
            elenst Elena Stepanova added a comment - The upstream bug is private, but the log and tests suggest that it was fixed in 5.5.37: revno: 4572 revision-id: bharathy.x.satish@oracle.com-20140107094105-orxie9xz39mm8esu parent: laasya.moduludu@oracle.com-20140106104305-j9iznr6wwpva4ifg committer: Bharathy Satish <bharathy.x.satish@oracle.com> branch nick: mysql-5.5 timestamp: Tue 2014-01-07 15:11:05 +0530 message: Bug #17503460 MYSQL READ ONLY DOESN'T WORK FOR DROP TRIGGER Problem: Drop Trigger succeeds even after setting read_only variable to ON. Fix: Fix is to report the standard error (ER_OPTION_PREVENTS_STATEMENT)when global read_only variable is set to ON. The fix was merged into MariaDB 5.5.37.

              People

              • Assignee:
                Unassigned
                Reporter:
                jnicol Jonathan Nicol
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: