From d9b159a2027c56c5c87385cfe1ae43b8c73a97b6 Mon Sep 17 00:00:00 2001 From: Chris Calender Date: Tue, 17 Apr 2018 15:00:15 -0400 Subject: MDEV-15789 - mysqlslap use incorrect table def The bug arises when one uses --auto-generate-sql-guid-primary (and --auto-generate-sql-secondary-indexes) with mysqlslap and also have sql_mode=STRICT_TRANS_TABLE. When using this option, mysqlslap should create a column with varchar(36), but it appears to create it as a varchar(32) only. Then if one has sql_mode=STRICT_TRANS_TABLES, it throws an error, like: mysqlslap: Cannot run query INSERT INTO t1 VALUES (...) ERROR : Data too long for column 'id' at row 1 Upstream bug report: BUG#80329. --- client/mysqlslap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/mysqlslap.c b/client/mysqlslap.c index a9746916411..ba7b8cea6a9 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -840,7 +840,7 @@ build_table_string(void) if (auto_generate_sql_guid_primary) { - dynstr_append(&table_string, "id varchar(32) primary key"); + dynstr_append(&table_string, "id varchar(36) primary key"); if (num_int_cols || num_char_cols || auto_generate_sql_guid_primary) dynstr_append(&table_string, ","); @@ -855,7 +855,7 @@ build_table_string(void) if (count) /* Except for the first pass we add a comma */ dynstr_append(&table_string, ","); - if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(32) unique key", count) + if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(36) unique key", count) > HUGE_STRING_LENGTH) { fprintf(stderr, "Memory Allocation error in create table\n"); -- cgit v1.2.1 From 1d43f71c7b4c39a6fd196c104b5ebafb65376199 Mon Sep 17 00:00:00 2001 From: Rutuja Surve Date: Sun, 10 Jun 2018 11:19:39 +0300 Subject: MDEV-15021: mysqldump --tables --routines generates non importable dump file The order of outputting stored procedures is important. Stored procedures must be available on view creation, for views which make use of them. Make sure to print them before outputting tables. --- client/mysqldump.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/mysqldump.c b/client/mysqldump.c index 4e611ed5cb2..ad71a4dd0ce 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -4701,6 +4701,12 @@ static int dump_selected_tables(char *db, char **table_names, int tables) if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", db, NullS); + /* obtain dump of routines (procs/functions) */ + if (opt_routines && mysql_get_server_version(mysql) >= 50009) + { + DBUG_PRINT("info", ("Dumping routines for database %s", db)); + dump_routines_for_db(db); + } /* Dump each selected table */ for (pos= dump_tables; pos < end; pos++) { @@ -4729,12 +4735,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables) DBUG_PRINT("info", ("Dumping events for database %s", db)); dump_events_for_db(db); } - /* obtain dump of routines (procs/functions) */ - if (opt_routines && mysql_get_server_version(mysql) >= 50009) - { - DBUG_PRINT("info", ("Dumping routines for database %s", db)); - dump_routines_for_db(db); - } free_root(&root, MYF(0)); my_free(order_by); order_by= 0; -- cgit v1.2.1 From 6da8192174f033c2958ddafb2a15c14360bb1ecc Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 10 Jun 2018 17:23:53 +0200 Subject: mysqltest: Allow HANDLER READ in --ps-protocol tests adjust tests --- client/mysqltest.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'client') diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 98e35136b2a..43dbff981d3 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -8672,6 +8672,7 @@ void init_re(void) "[[:space:]]*SELECT[[:space:]]|" "[[:space:]]*CREATE[[:space:]]+TABLE[[:space:]]|" "[[:space:]]*DO[[:space:]]|" + "[[:space:]]*HANDLER[[:space:]]+.*[[:space:]]+READ[[:space:]]|" "[[:space:]]*SET[[:space:]]+OPTION[[:space:]]|" "[[:space:]]*DELETE[[:space:]]+MULTI[[:space:]]|" "[[:space:]]*UPDATE[[:space:]]+MULTI[[:space:]]|" -- cgit v1.2.1