1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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
This commit is contained in:
Sergei Golubchik
2014-08-20 21:36:23 +02:00
parent 30ea6ddda0
commit 686f102eb9
3 changed files with 22 additions and 2 deletions

View File

@ -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|

View File

@ -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|

View File

@ -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;
} }