mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 17:14:30 +02:00
Bug#34861: mysqldump with --tab gives weird output for triggers.
mysqldump --tab still dumped triggers to stdout rather than to individual tables. We now append triggers to the .sql file for the corresponding table. --events and --routines correspond to a database rather than a table and will still go to stdout with --tab unless redirected with --result-file (-r). client/mysqldump.c: Extend open_sql_file_for_table() so we can open-append. Change dump_triggers_for_table() so it will append its output to the table's .sql-file when --tab is used. mysql-test/r/mysqldump.result: Show that when using --tab, triggers now end up in the .sql file with the corresponding table (after that table), while --routines and --events go to stdout or --result-file. mysql-test/t/mysqldump.test: Show that when using --tab, triggers now end up in the .sql file with the corresponding table (after that table), while --routines and --events go to stdout or --result-file.
This commit is contained in:
parent
d7d3c56aee
commit
7f50fc02c2
3 changed files with 132 additions and 20 deletions
|
|
@ -4226,6 +4226,57 @@ DROP DATABASE mysqldump_test_db;
|
|||
# -- End of test case for Bug#32538.
|
||||
|
||||
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
|
||||
|
||||
Bug #34861 - mysqldump with --tab gives weird output for triggers.
|
||||
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1;
|
||||
CREATE PROCEDURE pr1 () SELECT "Meow";
|
||||
CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow";
|
||||
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
|
||||
name body
|
||||
pr1 SELECT "Meow"
|
||||
|
||||
dump table; if anything goes to stdout, it ends up here: ---------------
|
||||
|
||||
drop everything
|
||||
DROP EVENT ev1;
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE pr1;
|
||||
|
||||
reload table; this should restore table and trigger
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
|
||||
name body
|
||||
|
||||
reload db; this should restore routines and events
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
|
||||
name body
|
||||
pr1 SELECT "Meow"
|
||||
|
||||
cleanup
|
||||
DROP EVENT IF EXISTS ev1;
|
||||
DROP PROCEDURE IF EXISTS pr1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue