[MDEV-31270] Wrong result on 2nd execution for PS with NULL on MAX function and IN predicate Created: 2023-05-15  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Prepared Statements
Affects Version/s: 10.4, 10.5, 10.6, 10.8, 10.9, 10.10, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Dmitry Shulga
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31003 Second execution for ps-protocol Stalled

 Description   

Testcase:

CREATE TABLE t1 (a INT) ENGINE=MyISAM;
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1);
 
prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
 
execute stmt1;
execute stmt1;
 
prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
execute stmt2;
execute stmt2;
 
deallocate prepare stmt1;
deallocate prepare stmt2;
drop table t1, t2;

Actual result:

prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
execute stmt1;
MAX(a)	bb
NULL	NULL
execute stmt1;
MAX(a)	bb
NULL	0
prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
execute stmt2;
MAX(a)	bb
NULL	NULL
execute stmt2;
MAX(a)	bb
NULL	1

Expected result:

prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
execute stmt1;
MAX(a)	bb
NULL	NULL
execute stmt1;
MAX(a)	bb
NULL	NULL
prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
execute stmt2;
MAX(a)	bb
NULL	NULL
execute stmt2;
MAX(a)	bb
NULL	NULL


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