Commit 847eb24b authored by Monty's avatar Monty

Fixed some wrong/inconsistent error message

- Added trigger name to "Trigger already exists" error message
- Added also missing query name to ER_DUP_QUERY_NAME
- Fixed wrong use of MASTER_DELAY_VALUE_OUT_OF_RANGE
parent b478276b
......@@ -1351,7 +1351,7 @@ CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.f' already exists
CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
......
......@@ -274,7 +274,7 @@ DROP TRIGGER tr1;
CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20;
CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'test.tr1' already exists
DROP TRIGGER IF EXISTS tr1;
DROP TRIGGER IF EXISTS tr1;
Warnings:
......
......@@ -10,7 +10,7 @@ SELECT @sum;
CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val;
CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'db1.val_' already exists
CREATE OR REPLACE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 2 + NEW.val;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
......@@ -21,7 +21,7 @@ SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val
ACTION_STATEMENT
SET @sum = @sum + 3 + NEW.val
CREATE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 4 + NEW.val;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'db1.val_' already exists
SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
ACTION_STATEMENT
SET @sum = @sum + 3 + NEW.val
......
......@@ -703,7 +703,7 @@ ERROR 42S21: Duplicate column name 'f1'
with t as (select * from t2 where c>3),
t as (select a from t1 where a>2)
select * from t,t1 where t1.a=t.c;
ERROR HY000: Duplicate query name in WITH clause
ERROR HY000: Duplicate query name `t` in WITH clause
with t as (select a from s where a<5),
s as (select a from t1 where b>='d')
select * from t,s where t.a=s.a;
......
......@@ -301,11 +301,11 @@ create trigger trg before insert on t2 for each row set @a:=1;
ERROR 42S02: Table 'test.t2' doesn't exist
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
ERROR HY000: Trigger 'test.trg' already exists
create trigger trg2 before insert on t1 for each row set @a:=1;
drop trigger trg2;
create trigger trg before insert on t3 for each row set @a:=1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
create trigger trg2 before insert on t3 for each row set @a:=1;
drop trigger trg2;
drop trigger trg;
......@@ -1986,7 +1986,7 @@ drop table if exists t1;
create table t1 (i int, j int);
create trigger t1_bi before insert on t1 for each row begin end;
create trigger t1_bi before insert on t1 for each row begin end;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.t1_' already exists
create trigger t1_bi2 before insert on t1 for each row begin end;
drop trigger t1_bi;
drop trigger t1_bi2;
......
......@@ -253,7 +253,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
......@@ -266,7 +266,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2
......
......@@ -459,7 +459,7 @@ Create trigger trg_3_406010_2 AFTER DELETE
on tb3 for each row set @test_var=@test_var+50;
Create trigger trg_3_406010_1 AFTER INSERT
on tb3 for each row set @test_var=@test_var+1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
select @test_var;
@test_var
1
......
......@@ -254,7 +254,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
......@@ -267,7 +267,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2
......
......@@ -459,7 +459,7 @@ Create trigger trg_3_406010_2 AFTER DELETE
on tb3 for each row set @test_var=@test_var+50;
Create trigger trg_3_406010_1 AFTER INSERT
on tb3 for each row set @test_var=@test_var+1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
select @test_var;
@test_var
1
......
......@@ -254,7 +254,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
......@@ -267,7 +267,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2
......
......@@ -19,7 +19,7 @@ SET @sum = @sum + NEW.val + 1
connection master;
CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val + 2;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'db1.val_' already exists
SELECT ACTION_STATEMENT AS ACTION_STATEMENT_Master FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
ACTION_STATEMENT_Master
SET @sum = @sum + NEW.val + 1
......
......@@ -5257,8 +5257,8 @@ ER_SP_GOTO_IN_HNDLR
eng "GOTO is not allowed in a stored procedure handler"
ger "GOTO ist im Handler einer gespeicherten Prozedur nicht erlaubt"
ER_TRG_ALREADY_EXISTS
eng "Trigger already exists"
ger "Trigger existiert bereits"
eng "Trigger '%s' already exists"
ger "Trigger '%s' existiert bereits"
ER_TRG_DOES_NOT_EXIST
eng "Trigger does not exist"
ger "Trigger existiert nicht"
......@@ -6471,7 +6471,7 @@ ER_CANNOT_LOAD_FROM_TABLE_V2
ger "Kann %s.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt"
ER_MASTER_DELAY_VALUE_OUT_OF_RANGE
eng "The requested value %u for the master delay exceeds the maximum %u"
eng "The requested value %lu for the master delay exceeds the maximum %lu"
ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT
eng "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)"
......@@ -7351,7 +7351,7 @@ ER_WITH_COL_WRONG_LIST
ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE
eng "Too many WITH elements in WITH clause"
ER_DUP_QUERY_NAME
eng "Duplicate query name in WITH clause"
eng "Duplicate query name %`-.64s in WITH clause"
ER_RECURSIVE_WITHOUT_ANCHORS
eng "No anchors for recursive WITH element '%s'"
ER_UNACCEPTABLE_MUTUAL_RECURSION
......
......@@ -833,6 +833,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
}
else if (lex->create_info.if_not_exists())
{
strxnmov(trigname_buff, sizeof(trigname_buff-1), tables->db, ".",
lex->spname->m_name.str, NullS);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_TRG_ALREADY_EXISTS,
ER_THD(thd, ER_TRG_ALREADY_EXISTS),
......@@ -850,7 +852,9 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
}
else
{
my_error(ER_TRG_ALREADY_EXISTS, MYF(0));
strxnmov(trigname_buff, sizeof(trigname_buff-1), tables->db, ".",
lex->spname->m_name.str, NullS);
my_error(ER_TRG_ALREADY_EXISTS, MYF(0), trigname_buff);
DBUG_RETURN(true);
}
}
......
......@@ -2230,7 +2230,7 @@ master_def:
if ($3 > MASTER_DELAY_MAX)
{
my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
$3, MASTER_DELAY_MAX);
(ulong) $3, (ulong) MASTER_DELAY_MAX);
}
else
Lex->mi.sql_delay = $3;
......
......@@ -1684,7 +1684,7 @@ master_def:
if ($3 > MASTER_DELAY_MAX)
{
my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
$3, MASTER_DELAY_MAX);
(ulong) $3, (ulong) MASTER_DELAY_MAX);
}
else
Lex->mi.sql_delay = $3;
......
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