summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqldump.test
diff options
context:
space:
mode:
authorunknown <tnurnberg@mysql.com/salvation.intern.azundris.com>2006-07-14 12:50:00 +0200
committerunknown <tnurnberg@mysql.com/salvation.intern.azundris.com>2006-07-14 12:50:00 +0200
commit3d35522f9dd91fb3166a18329d689b26a169e112 (patch)
tree2f8b1b724c97e3e08f91e1d928cd3541bf946359 /mysql-test/t/mysqldump.test
parent771f1461077a428871dd796ad2380deca21017a7 (diff)
downloadmariadb-git-3d35522f9dd91fb3166a18329d689b26a169e112.tar.gz
Bug#21014: Segmentation fault of mysqldump on view
mysqldump did not select the correct database before trying to dump views from it. this resulted in an empty result set, which in turn startled mysql-dump into a core-dump. this only happened for views, not for tables, and was only visible with multiple databases that weren't by sheer luck in the order mysqldump required, anyway. this fixes by selecting the correct database before dumping views; it also catches the empty set-condition if it should occur for other reasons. client/mysqldump.c: Bug#21014: Segmentation fault of mysqldump on view failsafe: if "select ... from information_schema.views" returns an empty set, don't deref NULL; throw an error instead. fix: select the correct database not only before dumping tables, but before dumping views, as well. mysql-test/r/mysqldump.result: Bug#21014: Segmentation fault of mysqldump on view show that mysqldump selects the correct database before trying to dump views from it. mysql-test/t/mysqldump.test: Bug#21014: Segmentation fault of mysqldump on view show that mysqldump selects the correct database before trying to dump views from it.
Diffstat (limited to 'mysql-test/t/mysqldump.test')
-rw-r--r--mysql-test/t/mysqldump.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 7e4fedb297d..575b9c98120 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1195,6 +1195,7 @@ drop table t1;
--exec $MYSQL_DUMP --force -N --compact --skip-comments test
--echo } mysqldump
drop view v1;
+
# BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views.
# Example code from Markus Popp
@@ -1211,3 +1212,21 @@ insert into t1 values (0815);
drop view v1;
drop table t1;
drop database mysqldump_test_db;
+
+# Bug21014 Segmentation fault of mysqldump on view
+
+create database mysqldump_tables;
+use mysqldump_tables;
+create table basetable ( id serial, tag varchar(64) );
+
+create database mysqldump_views;
+use mysqldump_views;
+create view nasishnasifu as select mysqldump_tables.basetable.id from
+mysqldump_tables.basetable;
+
+--exec $MYSQL_DUMP --skip-comments --compact --databases mysqldump_tables mysqldump_views;
+
+drop view nasishnasifu;
+drop database mysqldump_views;
+drop table mysqldump_tables.basetable;
+drop database mysqldump_tables;