Commit 686f102e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6609 SQL inside an anonymous block is executed with wrong SQL_MODE

MDEV-6606 Server crashes in String::append on selecting sql_mode inside anonymous block
parent 30ea6ddd
...@@ -155,11 +155,20 @@ execute stmt using @a, @b, @c| ...@@ -155,11 +155,20 @@ execute stmt using @a, @b, @c|
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; SELECT "test"."fn"(9) master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(9)
master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; SELECT "test"."fn"(1) master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(1)
master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3) master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3)
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
drop function fn| drop function fn|
drop table t1| drop table t1|
begin not atomic select @@sql_mode; end|
@@sql_mode
create table t1 (a int)|
select a from t1 having a > 1|
a
begin not atomic select a from t1 having a > 1; end|
a
drop table t1|
...@@ -148,3 +148,13 @@ delimiter |; ...@@ -148,3 +148,13 @@ delimiter |;
drop function fn| drop function fn|
drop table t1| drop table t1|
#
# MDEV-6606 Server crashes in String::append on selecting sql_mode inside anonymous block
# MDEV-6609 SQL inside an anonymous block is executed with wrong SQL_MODE
#
begin not atomic select @@sql_mode; end|
create table t1 (a int)|
select a from t1 having a > 1|
begin not atomic select a from t1 having a > 1; end|
drop table t1|
...@@ -254,6 +254,7 @@ static bool maybe_start_compound_statement(THD *thd) ...@@ -254,6 +254,7 @@ static bool maybe_start_compound_statement(THD *thd)
Lex->sp_chistics.suid= SP_IS_NOT_SUID; Lex->sp_chistics.suid= SP_IS_NOT_SUID;
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_ptr()); Lex->sphead->set_body_start(thd, YYLIP->get_cpp_ptr());
Lex->sphead->m_sql_mode= thd->variables.sql_mode;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment