mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge rama.(none):/home/jimw/my/mysql-5.0-clean
into rama.(none):/home/jimw/my/mysql-5.1-clean mysqldump.result is wrong, will need to be cleaned up.
This commit is contained in:
@ -863,8 +863,8 @@ static int get_options(int *argc, char ***argv)
|
|||||||
static void DB_error(MYSQL *mysql, const char *when)
|
static void DB_error(MYSQL *mysql, const char *when)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("DB_error");
|
DBUG_ENTER("DB_error");
|
||||||
my_printf_error(0,"Got error: %d: %s %s", MYF(0),
|
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
|
||||||
mysql_errno(mysql), mysql_error(mysql), when);
|
mysql_errno(mysql), mysql_error(mysql), when);
|
||||||
safe_exit(EX_MYSQLERR);
|
safe_exit(EX_MYSQLERR);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* DB_error */
|
} /* DB_error */
|
||||||
@ -892,8 +892,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
|
|||||||
if (mysql_query(mysql_con, query) ||
|
if (mysql_query(mysql_con, query) ||
|
||||||
(res && !((*res)= mysql_store_result(mysql_con))))
|
(res && !((*res)= mysql_store_result(mysql_con))))
|
||||||
{
|
{
|
||||||
my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0),
|
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
|
||||||
query, mysql_error(mysql_con), mysql_errno(mysql_con));
|
my_progname, query,
|
||||||
|
mysql_error(mysql_con), mysql_errno(mysql_con));
|
||||||
safe_exit(EX_MYSQLERR);
|
safe_exit(EX_MYSQLERR);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2380,7 +2381,10 @@ static void dump_table(char *table, char *db)
|
|||||||
check_io(md_result_file);
|
check_io(md_result_file);
|
||||||
}
|
}
|
||||||
if (mysql_query_with_error_report(mysql, 0, query))
|
if (mysql_query_with_error_report(mysql, 0, query))
|
||||||
|
{
|
||||||
DB_error(mysql, "when retrieving data from server");
|
DB_error(mysql, "when retrieving data from server");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
if (quick)
|
if (quick)
|
||||||
res=mysql_use_result(mysql);
|
res=mysql_use_result(mysql);
|
||||||
else
|
else
|
||||||
|
@ -1682,6 +1682,7 @@ select * from t1;
|
|||||||
a b
|
a b
|
||||||
Osnabr<EFBFBD>ck K<>ln
|
Osnabr<EFBFBD>ck K<>ln
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
--fields-optionally-enclosed-by="
|
||||||
create table `t1` (
|
create table `t1` (
|
||||||
t1_name varchar(255) default null,
|
t1_name varchar(255) default null,
|
||||||
t1_id int(10) unsigned not null auto_increment,
|
t1_id int(10) unsigned not null auto_increment,
|
||||||
|
@ -548,71 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3);
|
|||||||
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
|
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
|
|
||||||
#
|
|
||||||
|
|
||||||
create database db1;
|
|
||||||
use db1;
|
|
||||||
|
|
||||||
CREATE TABLE t2 (
|
|
||||||
a varchar(30) default NULL,
|
|
||||||
KEY a (a(5))
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO t2 VALUES ('alfred');
|
|
||||||
INSERT INTO t2 VALUES ('angie');
|
|
||||||
INSERT INTO t2 VALUES ('bingo');
|
|
||||||
INSERT INTO t2 VALUES ('waffle');
|
|
||||||
INSERT INTO t2 VALUES ('lemon');
|
|
||||||
create view v2 as select * from t2 where a like 'a%' with check option;
|
|
||||||
--exec $MYSQL_DUMP --skip-comments db1
|
|
||||||
drop table t2;
|
|
||||||
drop view v2;
|
|
||||||
drop database db1;
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bug 10713 mysqldump includes database in create view and referenced tables
|
|
||||||
#
|
|
||||||
|
|
||||||
# create table and views in db2
|
|
||||||
create database db2;
|
|
||||||
use db2;
|
|
||||||
create table t1 (a int);
|
|
||||||
create table t2 (a int, b varchar(10), primary key(a));
|
|
||||||
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
|
||||||
insert into t1 values (289), (298), (234), (456), (789);
|
|
||||||
create view v1 as select * from t2;
|
|
||||||
create view v2 as select * from t1;
|
|
||||||
|
|
||||||
# dump tables and view from db2
|
|
||||||
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
|
||||||
|
|
||||||
# drop the db, tables and views
|
|
||||||
drop table t1, t2;
|
|
||||||
drop view v1, v2;
|
|
||||||
drop database db2;
|
|
||||||
|
|
||||||
# create db1 and reload dump
|
|
||||||
create database db1;
|
|
||||||
use db1;
|
|
||||||
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
|
||||||
|
|
||||||
# check that all tables and views could be created
|
|
||||||
show tables;
|
|
||||||
select * from t2 order by a;
|
|
||||||
|
|
||||||
drop table t1, t2;
|
|
||||||
drop database db1;
|
|
||||||
|
|
||||||
#
|
|
||||||
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
|
|
||||||
#
|
|
||||||
|
|
||||||
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
|
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
|
||||||
#
|
#
|
||||||
@ -719,6 +654,12 @@ select * from t1;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
|
||||||
|
#
|
||||||
|
|
||||||
|
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
|
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
|
||||||
#
|
#
|
||||||
@ -760,14 +701,74 @@ create table t3(a int);
|
|||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #13318: Bad result with empty field and --hex-blob
|
# Bug #21288: mysqldump segmentation fault when using --where
|
||||||
#
|
#
|
||||||
create table t1 (a binary(1), b blob);
|
create table t1 (a int);
|
||||||
insert into t1 values ('','');
|
--error 2
|
||||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
|
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
|
||||||
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 4.1 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
|
||||||
|
#
|
||||||
|
|
||||||
|
create database db1;
|
||||||
|
use db1;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a varchar(30) default NULL,
|
||||||
|
KEY a (a(5))
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO t2 VALUES ('alfred');
|
||||||
|
INSERT INTO t2 VALUES ('angie');
|
||||||
|
INSERT INTO t2 VALUES ('bingo');
|
||||||
|
INSERT INTO t2 VALUES ('waffle');
|
||||||
|
INSERT INTO t2 VALUES ('lemon');
|
||||||
|
create view v2 as select * from t2 where a like 'a%' with check option;
|
||||||
|
--exec $MYSQL_DUMP --skip-comments db1
|
||||||
|
drop table t2;
|
||||||
|
drop view v2;
|
||||||
|
drop database db1;
|
||||||
|
use test;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug 10713 mysqldump includes database in create view and referenced tables
|
||||||
|
#
|
||||||
|
|
||||||
|
# create table and views in db2
|
||||||
|
create database db2;
|
||||||
|
use db2;
|
||||||
|
create table t1 (a int);
|
||||||
|
create table t2 (a int, b varchar(10), primary key(a));
|
||||||
|
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
||||||
|
insert into t1 values (289), (298), (234), (456), (789);
|
||||||
|
create view v1 as select * from t2;
|
||||||
|
create view v2 as select * from t1;
|
||||||
|
|
||||||
|
# dump tables and view from db2
|
||||||
|
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||||
|
|
||||||
|
# drop the db, tables and views
|
||||||
|
drop table t1, t2;
|
||||||
|
drop view v1, v2;
|
||||||
|
drop database db2;
|
||||||
|
use test;
|
||||||
|
|
||||||
|
# create db1 and reload dump
|
||||||
|
create database db1;
|
||||||
|
use db1;
|
||||||
|
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||||
|
|
||||||
|
# check that all tables and views could be created
|
||||||
|
show tables;
|
||||||
|
select * from t2 order by a;
|
||||||
|
|
||||||
|
drop table t1, t2;
|
||||||
|
drop database db1;
|
||||||
|
use test;
|
||||||
|
|
||||||
#
|
#
|
||||||
# dump of view
|
# dump of view
|
||||||
@ -832,6 +833,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
|
|||||||
|
|
||||||
drop view v1, v2, v3;
|
drop view v1, v2, v3;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test for dumping triggers
|
# Test for dumping triggers
|
||||||
#
|
#
|
||||||
@ -1057,20 +1059,6 @@ drop view v0;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# Check new --replace option
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
drop table if exists t1;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
CREATE TABLE t1(a int, b int);
|
|
||||||
INSERT INTO t1 VALUES (1,1);
|
|
||||||
INSERT INTO t1 VALUES (2,3);
|
|
||||||
INSERT INTO t1 VALUES (3,4), (4,5);
|
|
||||||
--exec $MYSQL_DUMP --replace --skip-comments test t1
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
|
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
|
||||||
# for tables with trigger created in the IGNORE_SPACE sql mode.
|
# for tables with trigger created in the IGNORE_SPACE sql mode.
|
||||||
@ -1095,7 +1083,14 @@ SET SQL_MODE = @old_sql_mode;
|
|||||||
DROP TRIGGER tr1;
|
DROP TRIGGER tr1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 4.1 tests
|
#
|
||||||
|
# Bug #13318: Bad result with empty field and --hex-blob
|
||||||
|
#
|
||||||
|
create table t1 (a binary(1), b blob);
|
||||||
|
insert into t1 values ('','');
|
||||||
|
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
|
||||||
|
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug 14871 Invalid view dump output
|
# Bug 14871 Invalid view dump output
|
||||||
@ -1126,7 +1121,6 @@ select * from v3 order by a;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
drop view v1, v2, v3, v4, v5;
|
drop view v1, v2, v3, v4, v5;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #16878 dump of trigger
|
# Bug #16878 dump of trigger
|
||||||
#
|
#
|
||||||
@ -1281,10 +1275,11 @@ use mysqldump_dbb;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop database mysqldump_dbb;
|
drop database mysqldump_dbb;
|
||||||
|
use test;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#21215 mysqldump creating incomplete backups without warning
|
# Bug#21215 mysqldump creating incomplete backups without warning
|
||||||
#
|
#
|
||||||
use test;
|
|
||||||
|
|
||||||
# Create user without sufficient privs to perform the requested operation
|
# Create user without sufficient privs to perform the requested operation
|
||||||
create user mysqltest_1@localhost;
|
create user mysqltest_1@localhost;
|
||||||
@ -1355,8 +1350,23 @@ drop table t1;
|
|||||||
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
|
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
|
||||||
drop user myDB_User;
|
drop user myDB_User;
|
||||||
drop database mysqldump_myDB;
|
drop database mysqldump_myDB;
|
||||||
--echo End of 5.0 tests
|
|
||||||
use test;
|
use test;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
# Check new --replace option
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int, b int);
|
||||||
|
INSERT INTO t1 VALUES (1,1);
|
||||||
|
INSERT INTO t1 VALUES (2,3);
|
||||||
|
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||||
|
--exec $MYSQL_DUMP --replace --skip-comments test t1
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Added for use-thread option
|
# Added for use-thread option
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user