← Back to team overview

maria-developers team mailing list archive

Re: 33787ea47a3: MDEV-6899: Database Dump has Syntax Error When Importing

 

Hi, Anel!

On Dec 23, Anel Husakovic wrote:
> revision-id: 33787ea47a3 (mariadb-10.2.31-588-g33787ea47a3)
> parent(s): ceef26cf866
> author: Anel Husakovic <anel@xxxxxxxxxxx>
> committer: Anel Husakovic <anel@xxxxxxxxxxx>
> timestamp: 2020-11-17 15:11:14 +0100
> message:
> 
> MDEV-6899: Database Dump has Syntax Error When Importing
> 
> ---
>  mysql-test/r/mysqldump.result | 32 ++++++++++++++++++++++++++++++++
>  mysql-test/t/mysqldump.test   | 26 ++++++++++++++++++++++++++
>  sql/events.cc                 | 10 ++++++++--
>  sql/sql_show.cc               |  4 +++-
>  4 files changed, 69 insertions(+), 3 deletions(-)
> 
> diff --git a/sql/events.cc b/sql/events.cc
> index abac2833833..2880113bc75 100644
> --- a/sql/events.cc
> +++ b/sql/events.cc
> @@ -680,6 +680,12 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
>    if (et->get_create_event(thd, &show_str))
>      DBUG_RETURN(TRUE);
>  
> +  LEX_STRING def_show_str= show_str.lex_string();
> +  if (!strcmp(&def_show_str.str[def_show_str.length -1], ";"))
> +  {
> +    --def_show_str.length;
> +    def_show_str.str[def_show_str.length]='\0';
> +  }

No, this is clearly wrong. The bug is that semicolon even gets into the
event definition, see other commands in the bug report.
You should fix that, not strip it away in SHOW CREATE, which will only
hide the bug.

Why is the semicolon parsed as a part of the event anyway?

>    field_list.push_back(new (mem_root)
>                         Item_empty_string(thd, "Event", NAME_CHAR_LEN),
>                         mem_root);
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx