Commit dae00c19 authored by anozdrin@mysql.com's avatar anozdrin@mysql.com

Fix for BUG#15103: SHOW TRIGGERS: small output alignment problem.

parent 4d272aba
...@@ -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,8 +1937,7 @@ end| ...@@ -1937,8 +1937,7 @@ 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;
...@@ -1947,8 +1946,7 @@ end BEFORE 0000-00-00 00:00:00 root@localhost ...@@ -1947,8 +1946,7 @@ 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,8 +2091,7 @@ t1 ...@@ -2096,8 +2091,7 @@ 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;
...@@ -2106,14 +2100,12 @@ end BEFORE # root@localhost ...@@ -2106,14 +2100,12 @@ 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;
......
...@@ -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;
......
...@@ -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