diff options
author | Vamsikrishna Bhagi <vamsikrishna.bhagi@oracle.com> | 2012-11-19 21:41:35 +0530 |
---|---|---|
committer | Vamsikrishna Bhagi <vamsikrishna.bhagi@oracle.com> | 2012-11-19 21:41:35 +0530 |
commit | f1e9b7219c040f328324ade5c91684f6bcd7c26c (patch) | |
tree | 3a528c9c14bdfe62aac33ccdc187f20268972996 /client/mysqldump.c | |
parent | 64e6119956df732c91f2cf6f0c6cffd5434253ab (diff) | |
download | mariadb-git-f1e9b7219c040f328324ade5c91684f6bcd7c26c.tar.gz |
Bug#14463669 FAILURE TO CORRECTLY PARSE ROUTINES IN
MYSQLDUMP OUTPUT
Problem: mysqldump when used with option --routines, dumps
all the routines of the specified database into
output. The statements in this output are written
in such a way that they are version safe using C
style version commenting (of the format
/*!<version num> <sql statement>*/). If a semicolon
is present right before closing of the comment in
dump output, it results in a syntax error while
importing.
Solution: Version comments for dumped routines are
specifically to protect the ones older than 5.0.
When the import is done on 5.0 or later versions,
entire create statement gets executed as all the
check conditions at the beginning of the comments
are cleared. Since the trade off is between the
performance of newer versions which are more in
use and protection of very old versions which are
no longer supported, it is proposed that these
comments be removed altogether to maintain
stability of the versions supported.
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r-- | client/mysqldump.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 765e547004e..65551051953 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2240,7 +2240,6 @@ static uint dump_routines_for_db(char *db) const char *routine_type[]= {"FUNCTION", "PROCEDURE"}; char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3]; char *routine_name; - char *query_str; int i; FILE *sql_file= md_result_file; MYSQL_RES *routine_res, *routine_list_res; @@ -2334,17 +2333,6 @@ static uint dump_routines_for_db(char *db) fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", routine_type[i], routine_name); - query_str= cover_definer_clause(row[2], strlen(row[2]), - C_STRING_WITH_LEN("50020"), - C_STRING_WITH_LEN("50003"), - C_STRING_WITH_LEN(" FUNCTION")); - - if (!query_str) - query_str= cover_definer_clause(row[2], strlen(row[2]), - C_STRING_WITH_LEN("50020"), - C_STRING_WITH_LEN("50003"), - C_STRING_WITH_LEN(" PROCEDURE")); - if (mysql_num_fields(routine_res) >= 6) { if (switch_db_collation(sql_file, db_name_buff, ";", @@ -2382,9 +2370,9 @@ static uint dump_routines_for_db(char *db) fprintf(sql_file, "DELIMITER ;;\n" - "/*!50003 %s */;;\n" + "%s ;;\n" "DELIMITER ;\n", - (const char *) (query_str != NULL ? query_str : row[2])); + (const char *) row[2]); restore_sql_mode(sql_file, ";"); @@ -2399,7 +2387,6 @@ static uint dump_routines_for_db(char *db) } } - my_free(query_str); } } /* end of routine printing */ mysql_free_result(routine_res); |