Commit 4eb2b162 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/home/alik/MySQL/devel/5.0-bug15103

parents 7c215273 f315b0b8
...@@ -816,40 +816,34 @@ end if; ...@@ -816,40 +816,34 @@ end if;
end| end|
show triggers; show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 trg1 INSERT t1 begin
begin
if new.j > 10 then if new.j > 10 then
set new.j := 10; set new.j := 10;
end if; end if;
end BEFORE NULL root@localhost end BEFORE NULL root@localhost
trg2 UPDATE t1 trg2 UPDATE t1 begin
begin
if old.i % 2 = 0 then if old.i % 2 = 0 then
set new.j := -1; set new.j := -1;
end if; end if;
end BEFORE NULL root@localhost end BEFORE NULL root@localhost
trg3 UPDATE t1 trg3 UPDATE t1 begin
begin
if new.j = -1 then if new.j = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
end AFTER NULL root@localhost end AFTER NULL root@localhost
select * from information_schema.triggers; select * from information_schema.triggers;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL test trg1 INSERT NULL test t1 0 NULL NULL test trg1 INSERT NULL test t1 0 NULL begin
begin
if new.j > 10 then if new.j > 10 then
set new.j := 10; set new.j := 10;
end if; end if;
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
NULL test trg2 UPDATE NULL test t1 0 NULL NULL test trg2 UPDATE NULL test t1 0 NULL begin
begin
if old.i % 2 = 0 then if old.i % 2 = 0 then
set new.j := -1; set new.j := -1;
end if; end if;
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
NULL test trg3 UPDATE NULL test t1 0 NULL NULL test trg3 UPDATE NULL test t1 0 NULL begin
begin
if new.j = -1 then if new.j = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
......
...@@ -1937,18 +1937,16 @@ end| ...@@ -1937,18 +1937,16 @@ end|
set sql_mode=default| set sql_mode=default|
show triggers like "t1"; show triggers like "t1";
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 trg1 INSERT t1 begin
begin
if new.a > 10 then if new.a > 10 then
set new.a := 10; set new.a := 10;
set new.a := 11; set new.a := 11;
end if; end if;
end BEFORE 0000-00-00 00:00:00 root@localhost end BEFORE 0000-00-00 00:00:00 root@localhost
trg2 UPDATE t1 begin trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if; if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE 0000-00-00 00:00:00 root@localhost end BEFORE 0000-00-00 00:00:00 root@localhost
trg3 UPDATE t1 trg3 UPDATE t1 begin
begin
if new.a = -1 then if new.a = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
...@@ -1986,8 +1984,7 @@ UNLOCK TABLES; ...@@ -1986,8 +1984,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;; DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;; /*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
begin
if new.a > 10 then if new.a > 10 then
set new.a := 10; set new.a := 10;
set new.a := 11; set new.a := 11;
...@@ -2000,8 +1997,7 @@ if old.a % 2 = 0 then set new.b := 12; end if; ...@@ -2000,8 +1997,7 @@ if old.a % 2 = 0 then set new.b := 12; end if;
end */;; end */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;; /*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin
begin
if new.a = -1 then if new.a = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
...@@ -2023,8 +2019,7 @@ UNLOCK TABLES; ...@@ -2023,8 +2019,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;; DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;; /*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
begin
if new.a > 10 then if new.a > 10 then
set @fired:= "No"; set @fired:= "No";
end if; end if;
...@@ -2096,24 +2091,21 @@ t1 ...@@ -2096,24 +2091,21 @@ t1
t2 t2
show triggers; show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 trg1 INSERT t1 begin
begin
if new.a > 10 then if new.a > 10 then
set new.a := 10; set new.a := 10;
set new.a := 11; set new.a := 11;
end if; end if;
end BEFORE # root@localhost end BEFORE # root@localhost
trg2 UPDATE t1 begin trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if; if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE # root@localhost end BEFORE # root@localhost
trg3 UPDATE t1 trg3 UPDATE t1 begin
begin
if new.a = -1 then if new.a = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
trg4 INSERT t2 trg4 INSERT t2 begin
begin
if new.a > 10 then if new.a > 10 then
set @fired:= "No"; set @fired:= "No";
end if; end if;
...@@ -2141,7 +2133,7 @@ a2 ...@@ -2141,7 +2133,7 @@ a2
1 1
SHOW TRIGGERS; SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
testref INSERT test1 BEGIN testref INSERT test1 BEGIN
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost
SELECT * FROM `test1`; SELECT * FROM `test1`;
a1 a1
......
...@@ -1466,12 +1466,12 @@ flush logs; ...@@ -1466,12 +1466,12 @@ flush logs;
-------- switch to master ------- -------- switch to master -------
SHOW TRIGGERS; SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
-------- switch to slave ------- -------- switch to slave -------
SHOW TRIGGERS; SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
######## DROP TRIGGER trg1 ######## ######## DROP TRIGGER trg1 ########
......
...@@ -34,7 +34,5 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The ...@@ -34,7 +34,5 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL
INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
...@@ -185,10 +185,8 @@ INSERT INTO t1 VALUES(6); ...@@ -185,10 +185,8 @@ INSERT INTO t1 VALUES(6);
ERROR 42000: Access denied; you need the SUPER privilege for this operation ERROR 42000: Access denied; you need the SUPER privilege for this operation
SHOW TRIGGERS; SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
trg2 INSERT t1
SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
DROP TRIGGER trg1; DROP TRIGGER trg1;
DROP TRIGGER trg2; DROP TRIGGER trg2;
CREATE TRIGGER trg1 BEFORE INSERT ON t1 CREATE TRIGGER trg1 BEFORE INSERT ON t1
...@@ -219,16 +217,11 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigge ...@@ -219,16 +217,11 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigge
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL
SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL
SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
---> connection: default ---> connection: default
DROP USER mysqltest_dfn@localhost; DROP USER mysqltest_dfn@localhost;
......
...@@ -613,7 +613,7 @@ select @a; ...@@ -613,7 +613,7 @@ select @a;
show triggers; show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost
t1_af INSERT t1 set @a=10 AFTER # root@localhost t1_af INSERT t1 set @a=10 AFTER # root@localhost
drop table t1; drop table t1;
set sql_mode="traditional"; set sql_mode="traditional";
create table t1 (a date); create table t1 (a date);
...@@ -634,7 +634,7 @@ t1 CREATE TABLE `t1` ( ...@@ -634,7 +634,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show triggers; show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
drop table t1; drop table t1;
create table t1 (id int); create table t1 (id int);
create trigger t1_ai after insert on t1 for each row flush tables; create trigger t1_ai after insert on t1 for each row flush tables;
......
...@@ -9103,6 +9103,8 @@ trigger_tail: ...@@ -9103,6 +9103,8 @@ trigger_tail:
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
lex->sphead->m_chistics= &lex->sp_chistics; lex->sphead->m_chistics= &lex->sp_chistics;
lex->sphead->m_body_begin= lex->ptr; lex->sphead->m_body_begin= lex->ptr;
while (my_isspace(system_charset_info, lex->sphead->m_body_begin[0]))
++lex->sphead->m_body_begin;
} }
sp_proc_stmt sp_proc_stmt
{ {
......
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