List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:June 28 2006 12:16am
Subject:bk commit into 5.0 tree (jimw:1.2200) BUG#18361
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2200 06/06/27 17:16:02 jimw@stripped +4 -0
  Bug #18005: Creating a trigger on mysql.event leads to server crash on scheduler startup
  Bug #18361: Triggers on mysql.user table cause server crash
  
   Because they do not work, we do not allow creating triggers on tables
   within the 'mysql' schema.
  
   (They may be made to work and re-enabled at some later date, but not
   in 5.0 or 5.1.)

  sql/sql_trigger.cc
    1.50 06/06/27 17:15:59 jimw@stripped +9 -0
    Disallow creating triggers on tables in the 'mysql' schema

  sql/share/errmsg.txt
    1.65 06/06/27 17:15:59 jimw@stripped +2 -0
    Add new error message

  mysql-test/t/trigger.test
    1.47 06/06/27 17:15:59 jimw@stripped +23 -1
    Add new regression test for creating triggers on system schema

  mysql-test/r/trigger.result
    1.42 06/06/27 17:15:59 jimw@stripped +12 -0
    Add new results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-18005

--- 1.64/sql/share/errmsg.txt	2006-05-14 13:51:02 -07:00
+++ 1.65/sql/share/errmsg.txt	2006-06-27 17:15:59 -07:00
@@ -5619,3 +5619,5 @@ ER_NON_GROUPING_FIELD_USED 42000
 	eng "non-grouping field '%-.64s' is used in %-.64s clause"
 ER_TABLE_CANT_HANDLE_SPKEYS
         eng "The used table type doesn't support SPATIAL indexes"
+ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
+	eng "Triggers can not be created on system tables"

--- 1.41/mysql-test/r/trigger.result	2006-06-16 09:21:21 -07:00
+++ 1.42/mysql-test/r/trigger.result	2006-06-27 17:15:59 -07:00
@@ -1078,3 +1078,15 @@ i1
 43
 51
 DROP TABLE t1;
+create trigger wont_work after update on mysql.user for each row
+begin
+set @a:= 1;
+end|
+ERROR HY000: Triggers can not be created on system tables
+use mysql|
+create trigger wont_work after update on event for each row
+begin
+set @a:= 1;
+end|
+ERROR HY000: Triggers can not be created on system tables
+End of 5.0 tests

--- 1.46/mysql-test/t/trigger.test	2006-06-16 09:21:21 -07:00
+++ 1.47/mysql-test/t/trigger.test	2006-06-27 17:15:59 -07:00
@@ -1281,4 +1281,26 @@ SELECT * FROM t1;
 
 DROP TABLE t1;
 
-# End of 5.0 tests
+#
+# Bug #18005: Creating a trigger on mysql.event leads to server crash on
+# scheduler startup
+#
+# Bug #18361: Triggers on mysql.user table cause server crash
+#
+# We don't allow triggers on the mysql schema
+delimiter |;
+--error ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
+create trigger wont_work after update on mysql.user for each row
+begin
+ set @a:= 1;
+end|
+# Try when we're already using the mysql schema
+use mysql|
+--error ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
+create trigger wont_work after update on event for each row
+begin
+ set @a:= 1;
+end|
+delimiter ;|
+
+--echo End of 5.0 tests

--- 1.49/sql/sql_trigger.cc	2006-03-27 13:01:48 -08:00
+++ 1.50/sql/sql_trigger.cc	2006-06-27 17:15:59 -07:00
@@ -183,6 +183,15 @@ bool mysql_create_or_drop_trigger(THD *t
       !(tables= add_table_for_trigger(thd, thd->lex->spname)))
     DBUG_RETURN(TRUE);
 
+  /*
+    We don't allow creating triggers on tables in the 'mysql' schema
+  */
+  if (create && !my_strcasecmp(system_charset_info, "mysql", tables->db))
+  {
+    my_error(ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA, MYF(0));
+    DBUG_RETURN(TRUE);
+  }
+
   /* We should have only one table in table list. */
   DBUG_ASSERT(tables->next_global == 0);
 
Thread
bk commit into 5.0 tree (jimw:1.2200) BUG#18361Jim Winstead28 Jun