Details
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
- All
- Comments
- Work Log
- History
- Activity
- Transitions
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.