1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix for bugs #5859 "DROP TABLE does not drop triggers" and

#6559 "DROP DATABASE forgets to drop triggers".

If we drop table we should also drop all triggers associated with it.
To do this we have to check for existence of .TRG file when we are 
dropping table and delete it too.


mysql-test/r/trigger.result:
  Added tests for bugs #5859 "DROP TABLE does not drop triggers"
  and #6559 "DROP DATABASE forgets to drop triggers".
mysql-test/t/trigger.test:
  Added tests for bugs #5859 "DROP TABLE does not drop triggers"
  and #6559 "DROP DATABASE forgets to drop triggers".
sql/handler.cc:
  Added .TRG to the list of known extensions of files associated with 
  tables.
sql/mysql_priv.h:
  Added declaration of constant holding extension for trigger files.
sql/sql_table.cc:
  mysql_rm_table_part2():
    If we drop table we should also drop all triggers associated with it.
    To do this we have to check for existence of .TRG file and delete it
    (until the moment when we will store trigger definitions in the same
     .FRM file as table description).
sql/sql_trigger.cc:
  Made constant holding extension for trigger files externally visible.
This commit is contained in:
unknown
2005-03-27 16:15:21 +04:00
parent 7ff83a3f7f
commit 2c5d427c87
6 changed files with 52 additions and 1 deletions

View File

@ -257,7 +257,19 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
/* Delete the table definition file */
strmov(end,reg_ext);
if (!(new_error=my_delete(path,MYF(MY_WME))))
{
some_tables_deleted=1;
/*
Destroy triggers for this table if there are any.
We won't need this as soon as we will have new .FRM format,
in which we will store trigger definitions in the same .FRM
files as table descriptions.
*/
strmov(end, triggers_file_ext);
if (!access(path, F_OK))
new_error= my_delete(path, MYF(MY_WME));
}
error|= new_error;
}
}