1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-41408 MTR prepared statement protocol skipping statements starting with '('

With --ps-protocol, mysqltest runs a SELECT a second time and compares
the results. The regex ps2_re only matched a leading SELECT, so a
statement starting with '(' was executed only once.

Allow any number of '(', each optionally followed by spaces, before
SELECT in ps2_re.
This commit is contained in:
Khaled Riyad
2026-10-08 19:29:09 +03:00
parent ce6b2906ca
commit 8bee0f3610
3 changed files with 27 additions and 1 deletions

View File

@@ -12769,7 +12769,7 @@ void init_re(void)
*/
const char *ps2_re_str =
"^("
"[[:space:]]*SELECT[[:space:]])";
"[[:space:]]*(\\([[:space:]]*)*SELECT[[:space:]])";
/*
Filter for queries that can be run as views

View File

@@ -32,3 +32,16 @@ a a
Warnings:
Warning 1052 Column 'a' in GROUP BY is ambiguous
drop table t;
#
# MDEV-41408 MTR prepared statement protocol skipping statements starting with '('
#
SELECT 1;
1
1
( ( SELECT 1));
1
1
SELECT $e2 - $e1 = $e1 - $e0 AS parens_same;
parens_same
1
# End of 10.11 tests

View File

@@ -32,3 +32,16 @@ select 1 + "2 a";
create table t (a int primary key, b blob default '');
select a, (2*a) AS a from t group by a;
drop table t;
--echo #
--echo # MDEV-41408 MTR prepared statement protocol skipping statements starting with '('
--echo #
let $e0= query_get_value(SHOW SESSION STATUS LIKE 'Com_stmt_execute', Value, 1);
SELECT 1;
let $e1= query_get_value(SHOW SESSION STATUS LIKE 'Com_stmt_execute', Value, 1);
( ( SELECT 1));
let $e2= query_get_value(SHOW SESSION STATUS LIKE 'Com_stmt_execute', Value, 1);
evalp SELECT $e2 - $e1 = $e1 - $e0 AS parens_same;
--echo # End of 10.11 tests