[MDEV-31160] multiple use of "SET STATEMENT sql_select_limit=xx FOR" set it at session level. Created: 2023-05-01  Updated: 2023-09-25  Resolved: 2023-09-25

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.11.1, 10.6.12
Fix Version/s: 10.4.32

Type: Bug Priority: Critical
Reporter: Diego Dupin Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-17711 Assertion `arena_for_set_stmt== 0' fa... Closed

 Description   

When using multi-statement capability, using multiple "SET STATEMENT sql_select_limit=xx FOR" in one query will set first "sql_select_limit" at session level, not only for the current query.

example executing command :
"SET STATEMENT sql_select_limit=2 FOR SELECT * FROM seq_1_to_5;SELECT * FROM seq_1_to_5;SET STATEMENT sql_select_limit=3 FOR SELECT * FROM seq_1_to_5;SELECT * FROM seq_1_to_5"

will return correctly return 2, 2, 3 and 3 rows, problem is that session sql_select_limit is then incorrectly set to value 2.



 Comments   
Comment by Bradley Grainger [ 2023-05-01 ]

Client-side discovery of this issue (with more background information): https://github.com/mysql-net/MySqlConnector/pull/1312#issuecomment-1528802391

Comment by Oleksandr Byelkin [ 2023-09-25 ]

diego dupin is following a multistatement test:

--source include/have_sequence.inc
 
delimiter //;
SET STATEMENT sql_select_limit=2 FOR SELECT * FROM seq_1_to_5;SELECT * FROM
seq_1_to_5;SET STATEMENT sql_select_limit=3 FOR SELECT * FROM seq_1_to_5;SELECT * FROM seq_1_to_5; //
 
delimiter ;//
 
SELECT * FROM seq_1_to_5;

Comment by Oleksandr Byelkin [ 2023-09-25 ]

OK it was fixed in MDEV-17711, that is why I can not repeat it

Generated at Thu Feb 08 10:21:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.