Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl

into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
parents cf9d1c91 e2d15b16
...@@ -658,13 +658,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -658,13 +658,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
tty_password=1; tty_password=1;
break; break;
case 'r': case 'r':
if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY, if (!(md_result_file= my_fopen(argument, O_WRONLY | FILE_BINARY,
MYF(MY_WME)))) MYF(MY_WME))))
exit(1); exit(1);
break; break;
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
#endif #endif
break; break;
case 'N': case 'N':
...@@ -679,7 +679,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -679,7 +679,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#include <sslopt-case.h> #include <sslopt-case.h>
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case 'X': case 'X':
opt_xml = 1; opt_xml= 1;
extended_insert= opt_drop= opt_lock= extended_insert= opt_drop= opt_lock=
opt_disable_keys= opt_autocommit= opt_create_db= 0; opt_disable_keys= opt_autocommit= opt_create_db= 0;
break; break;
...@@ -1442,7 +1442,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1442,7 +1442,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
const char *insert_option; const char *insert_option;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3], query_buff[512]; char table_buff2[NAME_LEN*2+3], query_buff[512];
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
int len; int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
...@@ -1486,7 +1486,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1486,7 +1486,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
if (opt_order_by_primary) if (opt_order_by_primary)
order_by = primary_key_fields(result_table); order_by= primary_key_fields(result_table);
if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff)) if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff))
{ {
...@@ -1538,7 +1538,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1538,7 +1538,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
field= mysql_fetch_field_direct(result, 0); field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0) if (strcmp(field->name, "View") == 0)
{ {
char *scv_buff = NULL; char *scv_buff= NULL;
verbose_msg("-- It's a view, create dummy table for view\n"); verbose_msg("-- It's a view, create dummy table for view\n");
...@@ -1575,7 +1575,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1575,7 +1575,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
...@@ -1939,7 +1939,7 @@ static void dump_triggers_for_table (char *table, char *db) ...@@ -1939,7 +1939,7 @@ static void dump_triggers_for_table (char *table, char *db)
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
char query_buff[512]; char query_buff[512];
uint old_opt_compatible_mode=opt_compatible_mode; uint old_opt_compatible_mode=opt_compatible_mode;
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
...@@ -2183,15 +2183,15 @@ static void dump_table(char *table, char *db) ...@@ -2183,15 +2183,15 @@ static void dump_table(char *table, char *db)
end= strmov(end,buff); end= strmov(end,buff);
if (where || order_by) if (where || order_by)
{ {
query = alloc_query_str((ulong) ((end - query) + 1 + query= alloc_query_str((ulong) ((end - query) + 1 +
(where ? strlen(where) + 7 : 0) + (where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0))); (order_by ? strlen(order_by) + 10 : 0)));
end = strmov(query, query_buf); end= strmov(query, query_buf);
if (where) if (where)
end = strxmov(end, " WHERE ", where, NullS); end= strxmov(end, " WHERE ", where, NullS);
if (order_by) if (order_by)
end = strxmov(end, " ORDER BY ", order_by, NullS); end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
if (mysql_real_query(mysql, query, (uint) (end - query))) if (mysql_real_query(mysql, query, (uint) (end - query)))
{ {
...@@ -2212,10 +2212,10 @@ static void dump_table(char *table, char *db) ...@@ -2212,10 +2212,10 @@ static void dump_table(char *table, char *db)
result_table); result_table);
if (where || order_by) if (where || order_by)
{ {
query = alloc_query_str((ulong) (strlen(query) + 1 + query= alloc_query_str((ulong) (strlen(query) + 1 +
(where ? strlen(where) + 7 : 0) + (where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0))); (order_by ? strlen(order_by) + 10 : 0)));
end = strmov(query, query_buf); end= strmov(query, query_buf);
if (where) if (where)
{ {
...@@ -2224,7 +2224,7 @@ static void dump_table(char *table, char *db) ...@@ -2224,7 +2224,7 @@ static void dump_table(char *table, char *db)
fprintf(md_result_file, "-- WHERE: %s\n", where); fprintf(md_result_file, "-- WHERE: %s\n", where);
check_io(md_result_file); check_io(md_result_file);
} }
end = strxmov(end, " WHERE ", where, NullS); end= strxmov(end, " WHERE ", where, NullS);
} }
if (order_by) if (order_by)
{ {
...@@ -2233,7 +2233,7 @@ static void dump_table(char *table, char *db) ...@@ -2233,7 +2233,7 @@ static void dump_table(char *table, char *db)
fprintf(md_result_file, "-- ORDER BY: %s\n", order_by); fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
check_io(md_result_file); check_io(md_result_file);
} }
end = strxmov(end, " ORDER BY ", order_by, NullS); end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
} }
if (!opt_xml && !opt_compact) if (!opt_xml && !opt_compact)
...@@ -2309,12 +2309,12 @@ static void dump_table(char *table, char *db) ...@@ -2309,12 +2309,12 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
} }
for (i = 0; i < mysql_num_fields(res); i++) for (i= 0; i < mysql_num_fields(res); i++)
{ {
int is_blob; int is_blob;
ulong length= lengths[i]; ulong length= lengths[i];
if (!(field = mysql_fetch_field(res))) if (!(field= mysql_fetch_field(res)))
{ {
my_snprintf(query, QUERY_LENGTH, my_snprintf(query, QUERY_LENGTH,
"%s: Not enough fields from table %s! Aborting.\n", "%s: Not enough fields from table %s! Aborting.\n",
...@@ -2386,7 +2386,7 @@ static void dump_table(char *table, char *db) ...@@ -2386,7 +2386,7 @@ static void dump_table(char *table, char *db)
else else
{ {
/* change any strings ("inf", "-inf", "nan") into NULL */ /* change any strings ("inf", "-inf", "nan") into NULL */
char *ptr = row[i]; char *ptr= row[i];
if (my_isalpha(charset_info, *ptr) || (*ptr == '-' && if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
my_isalpha(charset_info, ptr[1]))) my_isalpha(charset_info, ptr[1])))
dynstr_append(&extended_row, "NULL"); dynstr_append(&extended_row, "NULL");
...@@ -2446,7 +2446,7 @@ static void dump_table(char *table, char *db) ...@@ -2446,7 +2446,7 @@ static void dump_table(char *table, char *db)
else else
{ {
/* change any strings ("inf", "-inf", "nan") into NULL */ /* change any strings ("inf", "-inf", "nan") into NULL */
char *ptr = row[i]; char *ptr= row[i];
if (opt_xml) if (opt_xml)
{ {
print_xml_tag1(md_result_file, "\t\t", "field name=", print_xml_tag1(md_result_file, "\t\t", "field name=",
...@@ -2492,10 +2492,10 @@ static void dump_table(char *table, char *db) ...@@ -2492,10 +2492,10 @@ static void dump_table(char *table, char *db)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append(&extended_row,")");
row_length = 2 + extended_row.length; row_length= 2 + extended_row.length;
if (total_length + row_length < opt_net_buffer_length) if (total_length + row_length < opt_net_buffer_length)
{ {
total_length += row_length; total_length+= row_length;
fputc(',',md_result_file); /* Always row break */ fputc(',',md_result_file); /* Always row break */
fputs(extended_row.str,md_result_file); fputs(extended_row.str,md_result_file);
} }
...@@ -2507,7 +2507,7 @@ static void dump_table(char *table, char *db) ...@@ -2507,7 +2507,7 @@ static void dump_table(char *table, char *db)
fputs(insert_pat.str,md_result_file); fputs(insert_pat.str,md_result_file);
fputs(extended_row.str,md_result_file); fputs(extended_row.str,md_result_file);
total_length = row_length+init_length; total_length= row_length+init_length;
} }
check_io(md_result_file); check_io(md_result_file);
} }
...@@ -2572,15 +2572,15 @@ err: ...@@ -2572,15 +2572,15 @@ err:
static char *getTableName(int reset) static char *getTableName(int reset)
{ {
static MYSQL_RES *res = NULL; static MYSQL_RES *res= NULL;
MYSQL_ROW row; MYSQL_ROW row;
if (!res) if (!res)
{ {
if (!(res = mysql_list_tables(mysql,NullS))) if (!(res= mysql_list_tables(mysql,NullS)))
return(NULL); return(NULL);
} }
if ((row = mysql_fetch_row(res))) if ((row= mysql_fetch_row(res)))
return((char*) row[0]); return((char*) row[0]);
if (reset) if (reset)
...@@ -2588,7 +2588,7 @@ static char *getTableName(int reset) ...@@ -2588,7 +2588,7 @@ static char *getTableName(int reset)
else else
{ {
mysql_free_result(res); mysql_free_result(res);
res = NULL; res= NULL;
} }
return(NULL); return(NULL);
} /* getTableName */ } /* getTableName */
...@@ -2602,7 +2602,7 @@ static int dump_all_databases() ...@@ -2602,7 +2602,7 @@ static int dump_all_databases()
if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES")) if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES"))
return 1; return 1;
while ((row = mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
{ {
if (dump_all_tables_in_db(row[0])) if (dump_all_tables_in_db(row[0]))
result=1; result=1;
...@@ -2610,13 +2610,13 @@ static int dump_all_databases() ...@@ -2610,13 +2610,13 @@ static int dump_all_databases()
if (seen_views) if (seen_views)
{ {
if (mysql_query(mysql, "SHOW DATABASES") || if (mysql_query(mysql, "SHOW DATABASES") ||
!(tableres = mysql_store_result(mysql))) !(tableres= mysql_store_result(mysql)))
{ {
my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s", my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
MYF(0), mysql_error(mysql)); MYF(0), mysql_error(mysql));
return 1; return 1;
} }
while ((row = mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
{ {
if (dump_all_views_in_db(row[0])) if (dump_all_views_in_db(row[0]))
result=1; result=1;
...@@ -3048,7 +3048,7 @@ static int do_show_master_status(MYSQL *mysql_con) ...@@ -3048,7 +3048,7 @@ static int do_show_master_status(MYSQL *mysql_con)
} }
else else
{ {
row = mysql_fetch_row(master); row= mysql_fetch_row(master);
if (row && row[0] && row[1]) if (row && row[0] && row[1])
{ {
/* SHOW MASTER STATUS reports file and position */ /* SHOW MASTER STATUS reports file and position */
...@@ -3175,7 +3175,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, ...@@ -3175,7 +3175,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
MYSQL_FIELD *field; MYSQL_FIELD *field;
mysql_field_seek(result, 0); mysql_field_seek(result, 0);
for ( ; (field = mysql_fetch_field(result)) ; row++) for ( ; (field= mysql_fetch_field(result)) ; row++)
{ {
if (!strcmp(field->name,name)) if (!strcmp(field->name,name))
{ {
...@@ -3303,17 +3303,19 @@ char check_if_ignore_table(const char *table_name, char *table_type) ...@@ -3303,17 +3303,19 @@ char check_if_ignore_table(const char *table_name, char *table_type)
static char *primary_key_fields(const char *table_name) static char *primary_key_fields(const char *table_name)
{ {
MYSQL_RES *res = NULL; MYSQL_RES *res= NULL;
MYSQL_ROW row; MYSQL_ROW row;
/* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */ /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
char show_keys_buff[15 + NAME_LEN * 2 + 3]; char show_keys_buff[15 + NAME_LEN * 2 + 3];
uint result_length = 0; uint result_length= 0;
char *result = 0; char *result= 0;
char buff[NAME_LEN * 2 + 3];
char *quoted_field;
my_snprintf(show_keys_buff, sizeof(show_keys_buff), my_snprintf(show_keys_buff, sizeof(show_keys_buff),
"SHOW KEYS FROM %s", table_name); "SHOW KEYS FROM %s", table_name);
if (mysql_query(mysql, show_keys_buff) || if (mysql_query(mysql, show_keys_buff) ||
!(res = mysql_store_result(mysql))) !(res= mysql_store_result(mysql)))
{ {
fprintf(stderr, "Warning: Couldn't read keys from table %s;" fprintf(stderr, "Warning: Couldn't read keys from table %s;"
" records are NOT sorted (%s)\n", " records are NOT sorted (%s)\n",
...@@ -3328,12 +3330,14 @@ static char *primary_key_fields(const char *table_name) ...@@ -3328,12 +3330,14 @@ static char *primary_key_fields(const char *table_name)
* row, and UNIQUE keys come before others. So we only need to check * row, and UNIQUE keys come before others. So we only need to check
* the first key, not all keys. * the first key, not all keys.
*/ */
if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0) if ((row= mysql_fetch_row(res)) && atoi(row[1]) == 0)
{ {
/* Key is unique */ /* Key is unique */
do do
result_length += strlen(row[4]) + 1; /* + 1 for ',' or \0 */ {
while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1); quoted_field= quote_name(row[4], buff, 0);
result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
} while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
} }
/* Build the ORDER BY clause result */ /* Build the ORDER BY clause result */
...@@ -3341,17 +3345,21 @@ static char *primary_key_fields(const char *table_name) ...@@ -3341,17 +3345,21 @@ static char *primary_key_fields(const char *table_name)
{ {
char *end; char *end;
/* result (terminating \0 is already in result_length) */ /* result (terminating \0 is already in result_length) */
result = my_malloc(result_length + 10, MYF(MY_WME)); result= my_malloc(result_length + 10, MYF(MY_WME));
if (!result) if (!result)
{ {
fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n"); fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n");
goto cleanup; goto cleanup;
} }
mysql_data_seek(res, 0); mysql_data_seek(res, 0);
row = mysql_fetch_row(res); row= mysql_fetch_row(res);
end = strmov(result, row[4]); quoted_field= quote_name(row[4], buff, 0);
while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1) end= strmov(result, quoted_field);
end = strxmov(end, ",", row[4], NullS); while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1)
{
quoted_field= quote_name(row[4], buff, 0);
end= strxmov(end, ",", quoted_field, NullS);
}
} }
cleanup: cleanup:
...@@ -3419,7 +3427,7 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3419,7 +3427,7 @@ static my_bool get_view_structure(char *table, char* db)
char table_buff[NAME_LEN*2+3]; char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3];
char query[QUERY_LENGTH]; char query[QUERY_LENGTH];
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
DBUG_ENTER("get_view_structure"); DBUG_ENTER("get_view_structure");
if (opt_no_create_info) /* Don't write table creation info */ if (opt_no_create_info) /* Don't write table creation info */
......
...@@ -91,3 +91,18 @@ c ...@@ -91,3 +91,18 @@ c
---> Cleaning up... ---> Cleaning up...
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
select * from v1;
a b
1 6
drop table t1;
drop view v1;
...@@ -16,9 +16,9 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -16,9 +16,9 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 --exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2005 --echo # Bug #2005
# --echo #
CREATE TABLE t1 (a decimal(64, 20)); CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
...@@ -26,9 +26,9 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ...@@ -26,9 +26,9 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
--exec $MYSQL_DUMP --compact test t1 --exec $MYSQL_DUMP --compact test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2055 --echo # Bug #2055
# --echo #
CREATE TABLE t1 (a double); CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999'); INSERT INTO t1 VALUES ('-9e999999');
...@@ -38,9 +38,9 @@ INSERT INTO t1 VALUES ('-9e999999'); ...@@ -38,9 +38,9 @@ INSERT INTO t1 VALUES ('-9e999999');
--exec $MYSQL_DUMP --compact test t1 --exec $MYSQL_DUMP --compact test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #3361 mysqldump quotes DECIMAL values inconsistently --echo # Bug #3361 mysqldump quotes DECIMAL values inconsistently
# --echo #
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
...@@ -69,28 +69,28 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES"); ...@@ -69,28 +69,28 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
--exec $MYSQL_DUMP --skip-create --compact -X test t1 --exec $MYSQL_DUMP --skip-create --compact -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #1707 --echo # Bug #1707
# --echo #
CREATE TABLE t1 (`a"b"` char(2)); CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2"); INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --compact --skip-create -X test t1 --exec $MYSQL_DUMP --compact --skip-create -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #1994 --echo # Bug #1994
# Bug #4261 --echo # Bug #4261
# --echo #
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 --exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2634 --echo # Bug #2634
# --echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM; CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
...@@ -98,17 +98,17 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -98,17 +98,17 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1 --exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly' --echo # Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
# --echo #
create table ```a` (i int); create table ```a` (i int);
--exec $MYSQL_DUMP --compact test --exec $MYSQL_DUMP --compact test
drop table ```a`; drop table ```a`;
# --echo #
# Bug #2591 "mysqldump quotes names inconsistently" --echo # Bug #2591 "mysqldump quotes names inconsistently"
# --echo #
create table t1(a int); create table t1(a int);
--exec $MYSQL_DUMP --comments=0 test --exec $MYSQL_DUMP --comments=0 test
...@@ -119,9 +119,9 @@ set global sql_mode='ANSI_QUOTES'; ...@@ -119,9 +119,9 @@ set global sql_mode='ANSI_QUOTES';
set global sql_mode=''; set global sql_mode='';
drop table t1; drop table t1;
# --echo #
# Bug #2705 'mysqldump --tab extra output' --echo # Bug #2705 'mysqldump --tab extra output'
# --echo #
create table t1(a int); create table t1(a int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
...@@ -135,9 +135,9 @@ insert into t1 values (1),(2),(3); ...@@ -135,9 +135,9 @@ insert into t1 values (1),(2),(3);
--exec rm $MYSQLTEST_VARDIR/tmp/t1.txt --exec rm $MYSQLTEST_VARDIR/tmp/t1.txt
drop table t1; drop table t1;
# --echo #
# Bug #6101: create database problem --echo # Bug #6101: create database problem
# --echo #
--exec $MYSQL_DUMP --skip-comments --databases test --exec $MYSQL_DUMP --skip-comments --databases test
...@@ -145,32 +145,34 @@ create database mysqldump_test_db character set latin2 collate latin2_bin; ...@@ -145,32 +145,34 @@ create database mysqldump_test_db character set latin2 collate latin2_bin;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db --exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db
drop database mysqldump_test_db; drop database mysqldump_test_db;
# --echo #
# Bug #7020 --echo # Bug #7020
# Check that we don't dump in UTF8 in compatible mode by default, --echo # Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in --echo # but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8 --echo # --default-character-set=xxx. However, we should dump in UTF8
# if it is explicitely set. --echo # if it is explicitely set.
CREATE TABLE t1 (a CHAR(10)); CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 ''); INSERT INTO t1 VALUES (_latin1 '');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
#
# Bug#8063: make test mysqldump [ fail ] --echo #
# We cannot tes this command because its output depends --echo # Bug#8063: make test mysqldump [ fail ]
# on --default-character-set incompiled into "mysqldump" program. --echo # We cannot tes this command because its output depends
# If the future we can move this command into a separate test with --echo # on --default-character-set incompiled into "mysqldump" program.
# checking that "mysqldump" is compiled with "latin1" --echo # If the future we can move this command into a separate test with
# --echo # checking that "mysqldump" is compiled with "latin1"
--echo #
#--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1 #--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# WL #2319: Exclude Tables from dump --echo # WL #2319: Exclude Tables from dump
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
...@@ -180,18 +182,18 @@ INSERT INTO t2 VALUES (4),(5),(6); ...@@ -180,18 +182,18 @@ INSERT INTO t2 VALUES (4),(5),(6);
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
# --echo #
# Bug #8830 --echo # Bug #8830
# --echo #
CREATE TABLE t1 (`b` blob); CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A); INSERT INTO `t1` VALUES (0x602010000280100005E71A);
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 --exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Test for --insert-ignore --echo # Test for --insert-ignore
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
...@@ -200,10 +202,10 @@ INSERT INTO t1 VALUES (4),(5),(6); ...@@ -200,10 +202,10 @@ INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1 --exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #10286: mysqldump -c crashes on table that has many fields with long --echo # Bug #10286: mysqldump -c crashes on table that has many fields with long
# names --echo # names
# --echo #
create table t1 ( create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int, F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int, F_c81e728d9d4c2f636f067f89cc14862c int,
...@@ -539,18 +541,18 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); ...@@ -539,18 +541,18 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
--exec $MYSQL_DUMP --skip-comments -c test --exec $MYSQL_DUMP --skip-comments -c test
drop table t1; drop table t1;
# --echo #
# Test for --add-drop-database --echo # Test for --add-drop-database
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); 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;
# --echo #
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data --echo # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
# --echo #
CREATE DATABASE mysqldump_test_db; CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db; USE mysqldump_test_db;
...@@ -565,11 +567,11 @@ INSERT INTO t2 VALUES (1), (2); ...@@ -565,11 +567,11 @@ INSERT INTO t2 VALUES (1), (2);
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
# --echo #
# Testing with tables and databases that don't exists --echo # Testing with tables and databases that don't exists
# or contains illegal characters --echo # or contains illegal characters
# (Bug #9358 mysqldump crashes if tablename starts with \) --echo # (Bug #9358 mysqldump crashes if tablename starts with \)
# --echo #
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
create table t1(a varchar(30) primary key, b int not null); create table t1(a varchar(30) primary key, b int not null);
...@@ -629,9 +631,9 @@ drop database mysqldump_test_db; ...@@ -629,9 +631,9 @@ drop database mysqldump_test_db;
use test; use test;
# --echo #
# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly --echo # Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
# --echo #
create table t1 (a int(10)); create table t1 (a int(10));
create table t2 (pk int primary key auto_increment, create table t2 (pk int primary key auto_increment,
...@@ -641,9 +643,10 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir ...@@ -641,9 +643,10 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test --exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
drop table t1, t2; drop table t1, t2;
# --echo #
# BUG #12123 --echo # BUG #12123
# --echo #
create table t1 (a text character set utf8, b text character set latin1); create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1; select * from t1;
...@@ -654,15 +657,16 @@ select * from t1; ...@@ -654,15 +657,16 @@ select * from t1;
drop table t1; drop table t1;
# --echo #
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence --echo # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
# --echo #
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump --exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# --echo #
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]" --echo # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
# --echo #
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,
...@@ -689,9 +693,9 @@ show create table `t1`; ...@@ -689,9 +693,9 @@ show create table `t1`;
drop table `t1`; drop table `t1`;
# --echo #
# Bug #18536: wrong table order --echo # Bug #18536: wrong table order
# --echo #
create table t1(a int); create table t1(a int);
create table t2(a int); create table t2(a int);
...@@ -700,9 +704,10 @@ create table t3(a int); ...@@ -700,9 +704,10 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 --exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3; drop table t1, t2, t3;
# --echo #
# Bug #21288: mysqldump segmentation fault when using --where --echo # Bug #21288: mysqldump segmentation fault when using --where
# --echo #
create table t1 (a int); create table t1 (a int);
--error 2 --error 2
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
...@@ -710,9 +715,9 @@ drop table t1; ...@@ -710,9 +715,9 @@ drop table t1;
--echo End of 4.1 tests --echo End of 4.1 tests
# --echo #
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) --echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# --echo #
create database db1; create database db1;
use db1; use db1;
...@@ -734,9 +739,9 @@ drop view v2; ...@@ -734,9 +739,9 @@ drop view v2;
drop database db1; drop database db1;
use test; use test;
# --echo #
# Bug 10713 mysqldump includes database in create view and referenced tables --echo # Bug 10713 mysqldump includes database in create view and referenced tables
# --echo #
# create table and views in db2 # create table and views in db2
create database db2; create database db2;
...@@ -779,9 +784,9 @@ create view v1 as select * from t1; ...@@ -779,9 +784,9 @@ create view v1 as select * from t1;
drop view v1; drop view v1;
drop table t1; drop table t1;
# --echo #
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) --echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# --echo #
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
...@@ -803,18 +808,18 @@ drop view v2; ...@@ -803,18 +808,18 @@ drop view v2;
drop database mysqldump_test_db; drop database mysqldump_test_db;
use test; use test;
# --echo #
# Bug #9756 --echo # Bug #9756
# --echo #
CREATE TABLE t1 (a char(10)); CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\''); INSERT INTO t1 VALUES ('\'');
--exec $MYSQL_DUMP --skip-comments test t1 --exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #10927 mysqldump: Can't reload dump with view that consist of other view --echo # Bug #10927 mysqldump: Can't reload dump with view that consist of other view
# --echo #
create table t1(a int, b int, c varchar(30)); create table t1(a int, b int, c varchar(30));
...@@ -834,9 +839,9 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; ...@@ -834,9 +839,9 @@ 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;
# --echo #
# Test for dumping triggers --echo # Test for dumping triggers
# --echo #
CREATE TABLE t1 (a int, b bigint default NULL); CREATE TABLE t1 (a int, b bigint default NULL);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
...@@ -884,9 +889,9 @@ show tables; ...@@ -884,9 +889,9 @@ show tables;
show triggers; show triggers;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# --echo #
# Bugs #9136, #12917: problems with --defaults-extra-file option --echo # Bugs #9136, #12917: problems with --defaults-extra-file option
# --echo #
--system echo '[mysqltest1]' > $MYSQLTEST_VARDIR/tmp/tmp.cnf --system echo '[mysqltest1]' > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo 'port=1234' >> $MYSQLTEST_VARDIR/tmp/tmp.cnf --system echo 'port=1234' >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
...@@ -894,9 +899,9 @@ DROP TABLE t1, t2; ...@@ -894,9 +899,9 @@ DROP TABLE t1, t2;
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1 --exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf --system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
# --echo #
# Test of fix to BUG 12597 --echo # Test of fix to BUG 12597
# --echo #
DROP TABLE IF EXISTS `test1`; DROP TABLE IF EXISTS `test1`;
CREATE TABLE `test1` ( CREATE TABLE `test1` (
...@@ -932,9 +937,9 @@ DROP TRIGGER testref; ...@@ -932,9 +937,9 @@ DROP TRIGGER testref;
DROP TABLE test1; DROP TABLE test1;
DROP TABLE test2; DROP TABLE test2;
# --echo #
# BUG#9056 - mysqldump does not dump routines --echo # BUG#9056 - mysqldump does not dump routines
# --echo #
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
...@@ -981,9 +986,10 @@ DROP PROCEDURE bug9056_proc2; ...@@ -981,9 +986,10 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`; DROP PROCEDURE `a'b`;
drop table t1; drop table t1;
# --echo #
# BUG# 13052 - mysqldump timestamp reloads broken --echo # BUG# 13052 - mysqldump timestamp reloads broken
# --echo #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
...@@ -1003,9 +1009,10 @@ drop table t1; ...@@ -1003,9 +1009,10 @@ drop table t1;
set global time_zone=default; set global time_zone=default;
set time_zone=default; set time_zone=default;
# --echo #
# Test of fix to BUG 13146 - ansi quotes break loading of triggers --echo # Test of fix to BUG 13146 - ansi quotes break loading of triggers
# --echo #
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS `t1 test`; DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`; DROP TABLE IF EXISTS `t2 test`;
...@@ -1036,9 +1043,9 @@ DROP TRIGGER `test trig`; ...@@ -1036,9 +1043,9 @@ DROP TRIGGER `test trig`;
DROP TABLE `t1 test`; DROP TABLE `t1 test`;
DROP TABLE `t2 test`; DROP TABLE `t2 test`;
# --echo #
# BUG# 12838 mysqldump -x with views exits with error --echo # BUG# 12838 mysqldump -x with views exits with error
# --echo #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -1060,10 +1067,10 @@ drop view v0; ...@@ -1060,10 +1067,10 @@ drop view v0;
drop view v1; drop view v1;
drop table t1; drop table t1;
# --echo #
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN" --echo # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode. --echo # for tables with trigger created in the IGNORE_SPACE sql mode.
# --echo #
SET @old_sql_mode = @@SQL_MODE; SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE; SET SQL_MODE = IGNORE_SPACE;
...@@ -1084,18 +1091,19 @@ SET SQL_MODE = @old_sql_mode; ...@@ -1084,18 +1091,19 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #13318: Bad result with empty field and --hex-blob --echo # Bug #13318: Bad result with empty field and --hex-blob
# --echo #
create table t1 (a binary(1), b blob); create table t1 (a binary(1), b blob);
insert into t1 values ('',''); insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1 --exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1 --exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1; drop table t1;
# --echo #
# Bug 14871 Invalid view dump output --echo # Bug 14871 Invalid view dump output
# --echo #
create table t1 (a int); create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789); insert into t1 values (289), (298), (234), (456), (789);
...@@ -1122,9 +1130,9 @@ select * from v3 order by a; ...@@ -1122,9 +1130,9 @@ 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;
# --echo #
# Bug #16878 dump of trigger --echo # Bug #16878 dump of trigger
# --echo #
create table t1 (a int, created datetime); create table t1 (a int, created datetime);
create table t2 (b int, created datetime); create table t2 (b int, created datetime);
...@@ -1152,11 +1160,10 @@ drop trigger tr1; ...@@ -1152,11 +1160,10 @@ drop trigger tr1;
drop trigger tr2; drop trigger tr2;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
--echo #
#
# Bug#18462 mysqldump does not dump view structures correctly
#
#
create table t (qty int, price int); create table t (qty int, price int);
insert into t values(3, 50); insert into t values(3, 50);
insert into t values(5, 51); insert into t values(5, 51);
...@@ -1173,11 +1180,11 @@ drop view v2; ...@@ -1173,11 +1180,11 @@ drop view v2;
drop table t; drop table t;
# --echo #
# Bug#14857 Reading dump files with single statement stored routines fails. --echo # Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878 --echo # fixed by patch for bug#16878
# --echo #
#
DELIMITER |; DELIMITER |;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20) /*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */| return 42 */|
...@@ -1189,10 +1196,10 @@ show create procedure p; ...@@ -1189,10 +1196,10 @@ show create procedure p;
drop function f; drop function f;
drop procedure p; drop procedure p;
# --echo #
# Bug #17371 Unable to dump a schema with invalid views --echo # Bug #17371 Unable to dump a schema with invalid views
# --echo #
#
create table t1 ( id serial ); create table t1 ( id serial );
create view v1 as select * from t1; create view v1 as select * from t1;
drop table t1; drop table t1;
...@@ -1203,9 +1210,9 @@ drop table t1; ...@@ -1203,9 +1210,9 @@ drop table t1;
--echo } mysqldump --echo } mysqldump
drop view v1; drop view v1;
# BUG#17201 Spurious 'DROP DATABASE' in output, --echo # BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views. --echo # also confusion between tables and views.
# Example code from Markus Popp --echo # Example code from Markus Popp
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
...@@ -1220,7 +1227,9 @@ drop view v1; ...@@ -1220,7 +1227,9 @@ drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
# Bug21014 Segmentation fault of mysqldump on view --echo #
--echo # Bug21014 Segmentation fault of mysqldump on view
--echo #
create database mysqldump_tables; create database mysqldump_tables;
use mysqldump_tables; use mysqldump_tables;
...@@ -1237,7 +1246,9 @@ drop database mysqldump_views; ...@@ -1237,7 +1246,9 @@ drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps --echo #
--echo # Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo #
create database mysqldump_dba; create database mysqldump_dba;
use mysqldump_dba; use mysqldump_dba;
...@@ -1276,9 +1287,9 @@ drop table t1; ...@@ -1276,9 +1287,9 @@ drop table t1;
drop database mysqldump_dbb; drop database mysqldump_dbb;
use test; use test;
# --echo #
# Bug#21215 mysqldump creating incomplete backups without warning --echo # Bug#21215 mysqldump creating incomplete backups without warning
# --echo #
# 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;
...@@ -1318,12 +1329,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; ...@@ -1318,12 +1329,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# --echo #
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the --echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database. --echo # information_schema database.
# --echo #
# Bug #21424 mysqldump failing to export/import views --echo # Bug #21424 mysqldump failing to export/import views
# --echo #
# Do as root # Do as root
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
...@@ -1357,8 +1368,10 @@ drop user myDB_User; ...@@ -1357,8 +1368,10 @@ drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
flush privileges; flush privileges;
# Bug #21424 continues from here. --echo # Bug #21424 continues from here.
# Restore. Flush Privileges test ends. --echo # Restore. Flush Privileges test ends.
--echo #
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql;
# Do as a user # Do as a user
...@@ -1380,4 +1393,25 @@ drop user myDB_User; ...@@ -1380,4 +1393,25 @@ drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; use test;
--echo End of 5.0 tests --echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo #
--echo # End of 5.0 tests
--echo #
...@@ -129,3 +129,23 @@ DROP TABLE t1; ...@@ -129,3 +129,23 @@ DROP TABLE t1;
--sync_with_master --sync_with_master
--connection master --connection master
#
# BUG#19419: "VIEW: View that the column name is different
# by master and slave is made".
#
connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
sync_slave_with_master;
explain v1;
show create table v1;
select * from v1;
connection master;
drop table t1;
drop view v1;
sync_slave_with_master;
...@@ -4765,6 +4765,19 @@ end_with_restore_list: ...@@ -4765,6 +4765,19 @@ end_with_restore_list:
} }
append_identifier(thd, &buff, first_table->table_name, append_identifier(thd, &buff, first_table->table_name,
first_table->table_name_length); first_table->table_name_length);
if (lex->view_list.elements)
{
List_iterator_fast<LEX_STRING> names(lex->view_list);
LEX_STRING *name;
int i;
for (i= 0; name= names++; i++)
{
buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length);
}
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS ")); buff.append(STRING_WITH_LEN(" AS "));
buff.append(first_table->source.str, first_table->source.length); buff.append(first_table->source.str, first_table->source.length);
......
...@@ -6921,6 +6921,9 @@ load: LOAD DATA_SYM ...@@ -6921,6 +6921,9 @@ load: LOAD DATA_SYM
YYABORT; YYABORT;
} }
lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT; YYABORT;
}; };
...@@ -6959,6 +6962,9 @@ load_data: ...@@ -6959,6 +6962,9 @@ load_data:
FROM MASTER_SYM FROM MASTER_SYM
{ {
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
WARN_DEPRECATED("LOAD DATA FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
}; };
opt_local: opt_local:
......
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