1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug#37117875 Binlog record error when delimiter is set to other symbols

Description:
------------
When the delimiter is set to a non-default symbol and the SQL
statement contains an unquoted semicolon (;) within a MySQL-specific
comment, the SQL executes successfully in the source database.
However, the binlog record becomes incomplete, leading to a syntax
error in the replica database.

Analysis:
------------
When the delimiter is set to a non-default symbol and an SQL
statement contains an unquoted semicolon within a MySQL-specific
comment, the client transmits the entire SQL statement, including
the MySQL-specific comment, up to the delimiter to the server.
During parsing, the server interprets the semicolon as the end of the
command while processing the comment, resulting in the execution of
a partial statement. The truncated statement is then recorded in
the binary log and propagated to the replica, leading to an error.

Fix:
------------
When the delimiter is set to a non-default symbol, treat
MySQL-specific comments containing unquoted semicolons as syntax
errors and return a parser error.

Change-Id: I00d6b4ced89e79a7350c94218bf2527553054aed
This commit is contained in:
Justin Jose
2025-02-27 08:44:14 +05:30
committed by Sergei Golubchik
parent b0a2b921cc
commit 1735807448

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2022, MariaDB Corporation.
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Copyright (c) 2009, 2025, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2564,6 +2564,8 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
state=MY_LEX_CHAR;
break;
case MY_LEX_END:
/* Unclosed special comments result in a syntax error */
if (in_comment == DISCARD_COMMENT) return (ABORT_SYM);
next_state= MY_LEX_END;
return(0); // We found end of input last time