Commit 95552a89 authored by unknown's avatar unknown

Bug#10946: Confusing error messeges in the case of duplicate trigger definition

It was hard to distinguish case, when one was unable to create trigger
on the table because trigger with same action time and event already
existed for this table, from the case, when one tried to create trigger
with name which was already occupied by some other trigger, since in
both these cases we emitted ER_TRG_ALREADY_EXISTS error and message.
Now we emit ER_NOT_SUPPORTED_YET error with appropriate additional
message in the first case. There is no sense in introducing separate
error for this situation since we plan to get rid of this limitation
eventually.


mysql-test/r/trigger.result:
  Update result for new error message.
mysql-test/t/trigger.test:
  Update test for new error code.
sql/sql_trigger.cc:
  If there is already a trigger with the same activation time, report an
  "Unsupported yet" error.
parent 774da9ec
......@@ -295,7 +295,7 @@ create trigger trg before insert on t1 for each row set @a:=1;
create trigger trg after insert on t1 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t1 for each row set @a:=1;
ERROR HY000: Trigger already exists
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
create trigger trg before insert on t3 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t3 for each row set @a:=1;
......
......@@ -321,7 +321,7 @@ create trigger trg before insert on t2 for each row set @a:=1;
create trigger trg before insert on t1 for each row set @a:=1;
--error 1359
create trigger trg after insert on t1 for each row set @a:=1;
--error 1359
--error 1235
create trigger trg2 before insert on t1 for each row set @a:=1;
--error 1359
create trigger trg before insert on t3 for each row set @a:=1;
......
......@@ -366,7 +366,9 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
/* We don't allow creation of several triggers of the same type yet */
if (bodies[lex->trg_chistics.event][lex->trg_chistics.action_time])
{
my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"multiple triggers with the same action time"
" and event for one table");
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment