← Back to team overview

maria-developers team mailing list archive

Re: [Commits] 9b999e79a35: MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE

 

sujatha <sujatha.sivakumar@xxxxxxxxxxx> writes:

> In MariaDB 10.3 and later, setting the sql_mode system variable to Oracle
> allows the server to understand a subset of Oracle's PL/SQL language. When
> sql_mode=ORACLE is set, it switches the parser from the MariaDB parser to
> Oracle compatible parser. With this change 'BEGIN' is not considered as
> 'START TRANSACTION'. Hence the syntax error is reported.
>
> Fix:
> ===
> Add a new option to 'mysqlbinlog' tool named 'sql_mode_oracle'. When
> 'sql_mode_oracle' option is specified 'BEGIN' statements will be replaced
> with 'START TRANSACTION' in the mysqlbinlog output.

Why not instead turn off the sql_mode=oracle at the start of the mysqlbinlog
output? Just like the output of mysqlbinlog already sets up a number of
other session modes/parameters for the following statements to work
correctly, eg:

  SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
  SET @@session.sql_mode=1073741824/*!*/;

In fact, the above output from my 10.3.22 mysqlbinlog already is setting
sql_mode explicitly - why doesn't that clear the sql_mode=oracle and prevent
the problem from occurring in the first place? Could that be the real bug?

 - Kristian.


Follow ups

References