Item_in_subselect::val_int incorrectly called for a DELETE statement in prepared mode resulting in failed assert.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Timour Katchaounov |
Bug Description
When run with --ps-protocol the test file subselect.test crashes with
a failed assert as follows:
DELETE FROM t1 WHERE topic IN (SELECT DISTINCT topic FROM t2 WHERE NOT
EXISTS(SELECT * FROM t3 WHERE numeropost=topic))
Results in Item_in_
resulting in a failed assert.
function=
#7 0x000000000064787b in Item_in_
#8 0x000000000070ba76 in SQL_SELECT:
#9 0x000000000078d7cc in mysql_delete (thd=0x3d0d018, table_list=
reset_
#10 0x00000000006bcc39 in mysql_execute_
#11 0x0000000000781c37 in Prepared_
#12 0x0000000000780de3 in Prepared_
packet_
#13 0x000000000077ebb9 in mysqld_stmt_execute (thd=0x3d0d018, packet_
#14 0x00000000006b6ffe in dispatch_command (command=
#15 0x00000000006b653e in do_command (thd=0x3d0d018) at sql_parse.cc:903
Related branches
Changed in maria: | |
status: | In Progress → Fix Committed |
status: | Fix Committed → Fix Released |
Test case extracted from subselect.test:
CREATE TABLE t1 ( date,topic) , date,topic) ,
mot varchar(30) character set latin1 NOT NULL default '',
topic mediumint(8) unsigned NOT NULL default '0',
date date NOT NULL default '0000-00-00',
pseudo varchar(35) character set latin1 NOT NULL default '',
PRIMARY KEY (mot,pseudo,
KEY pseudo (pseudo,
KEY topic (topic)
) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE t2 ( date,topic) , date,topic) ,
mot varchar(30) character set latin1 NOT NULL default '',
topic mediumint(8) unsigned NOT NULL default '0',
date date NOT NULL default '0000-00-00',
pseudo varchar(35) character set latin1 NOT NULL default '',
PRIMARY KEY (mot,pseudo,
KEY pseudo (pseudo,
KEY topic (topic)
) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE t3 (
numeropost mediumint(8) unsigned NOT NULL auto_increment,
maxnumrep int(10) unsigned NOT NULL default '0',
PRIMARY KEY (numeropost),
UNIQUE KEY maxnumrep (maxnumrep)
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('joce' ,'1','' ,'joce' ),('test' ,'2','' ,'test' );
INSERT INTO t2 VALUES ('joce' ,'1','' ,'joce' ),('test' ,'2','' ,'test' );
INSERT INTO t3 VALUES (1,1);
-- this statement works fine
WHERE NOT EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
DELETE FROM t1
WHERE topic IN (SELECT DISTINCT topic FROM t2
prepare st1 from "
WHERE NOT EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
DELETE FROM t1
WHERE topic IN (SELECT DISTINCT topic FROM t2
";
-- this statement results in a failed assert
execute st1;