mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19639 + MDEV-19640 fix + preparatory changes for WL#4179
This patch includes: - MDEV-19639 sql_mode=ORACLE: Wrong SHOW PROCEDURE output for sysvar:=expr - MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr - Preparatory refactoring for MySQL WL#4179 Detailed change list: 1. Changing sp_create_assignment_lex() to accept the position in the exact query buffer instead of a "bool no_lookahead". This actually fixes MDEV-19639. In the previous reduction sp_create_assignment_lex() was called too late, when the parser went far the from beginning of the statement, so only a part of the statement got into sp_instr_stmt. 2. Generating "SET" or "SET GLOBAL" inside sp_create_assignment_instr() depending on the option type. This fixes MDEV-19640. In the previous reduction the code passed (through no_lookahead) the position of the word GLOBAL inside sp_create_assignment_lex(), which worked only for the left-most assignment. 3. Fixing the affected rules to use: - ident_cli instead of ident - ident_cli_set_usual_case instead of ident_set_usual_case 4. Changing the input parameter in: - LEX::set_system_variable() - LEX::call_statement_start() - LEX::set_variable() from just LEX_CSTRING to Lex_ident_sys_st for stricter data type constrol: to make sure that noone passes an ident_cli (a fragment of the original query in the client character set) instead of server-side identifier (utf8 identifier allocated on THD when needed). 5. Adding Lex_ident_sys() in places where the affected functions are called. 6. Moving all calls of sp_create_assignment_lex() to the places just before parsing set_expr_or_default. This makes the grammar clearer, because sp_create_assignment_lex() and sp_create_assignment_instr() now stay near each other, so the balance of LEX's push/pop can be read easier. This will also help to WL#4179. 7. Adding class sp_lex_set_var Moving the initialization code from sp_create_assignment_lex() to the constructor of sp_lex_set_var. This will also help to WL#4179. 8. Moving a part of the "set" grammar rule into a separate rule "set_param". This makes the grammar easier to read and removes one shift/reduce conflict.
This commit is contained in:
@ -847,8 +847,8 @@ drop procedure if exists p_20906_b;
|
||||
create procedure p_20906_a() SET @a=@a+1, @b=@b+1;
|
||||
show procedure code p_20906_a;
|
||||
Pos Instruction
|
||||
0 stmt 31 "SET @a=@a+1"
|
||||
1 stmt 31 "SET @b=@b+1"
|
||||
0 stmt 31 "SET @a=@a+1"
|
||||
1 stmt 31 "SET @b=@b+1"
|
||||
set @a=1;
|
||||
set @b=1;
|
||||
call p_20906_a();
|
||||
@ -858,9 +858,9 @@ select @a, @b;
|
||||
create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1;
|
||||
show procedure code p_20906_b;
|
||||
Pos Instruction
|
||||
0 stmt 31 "SET @a=@a+1"
|
||||
1 stmt 31 "SET @b=@b+1"
|
||||
2 stmt 31 "SET @c=@c+1"
|
||||
0 stmt 31 "SET @a=@a+1"
|
||||
1 stmt 31 "SET @b=@b+1"
|
||||
2 stmt 31 "SET @c=@c+1"
|
||||
set @a=1;
|
||||
set @b=1;
|
||||
set @c=1;
|
||||
@ -1328,3 +1328,18 @@ Pos Instruction
|
||||
4 jump 2
|
||||
5 hpop 1
|
||||
drop function f1;
|
||||
#
|
||||
# MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
|
||||
#
|
||||
CREATE OR REPLACE PROCEDURE p1()
|
||||
BEGIN
|
||||
SET GLOBAL max_allowed_packet=16000000, max_error_count=60;
|
||||
SELECT @@GLOBAL.max_allowed_packet, @@GLOBAL.max_error_count;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE p1;
|
||||
Pos Instruction
|
||||
0 stmt 31 "SET GLOBAL max_allowed_packet=16000000"
|
||||
1 stmt 31 "SET GLOBAL max_error_count=60"
|
||||
2 stmt 0 "SELECT @@GLOBAL.max_allowed_packet, @..."
|
||||
DROP PROCEDURE p1;
|
||||
|
Reference in New Issue
Block a user