Skip to content

Commit 2613719

Browse files
committed
Bug#18439019 Assert in mysql_multi_update with ordered view
Adding test case.
1 parent 2c5b9b9 commit 2613719

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

mysql-test/r/delete.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,3 +731,12 @@ ORDER BY INNR1 . col_datetime_key
731731
ERROR 21000: Subquery returns more than 1 row
732732
DROP TABLE t1, t2, t3, t4, t5;
733733
SET sql_mode=default;
734+
# Bug#20450013 assertion 'select_lex::having_cond() == __null ...
735+
CREATE TABLE t1(a TEXT, FULLTEXT (a));
736+
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
737+
explain DELETE FROM t1 USING v1,t1;
738+
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
739+
1 DELETE NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
740+
DELETE FROM t1 USING v1,t1;
741+
DROP VIEW v1;
742+
DROP TABLE t1;

mysql-test/r/update.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,23 @@ Variable_name Value
605605
Handler_update 5
606606
ROLLBACK;
607607
DROP TABLE t1, t2;
608+
# Bug#18439019 Assert in mysql_multi_update with ordered view
609+
CREATE TABLE t1 (
610+
a int unsigned not null auto_increment primary key,
611+
b int unsigned
612+
) ENGINE=MyISAM;
613+
CREATE TABLE t2 (
614+
a int unsigned not null auto_increment primary key,
615+
b int unsigned
616+
) ENGINE=MyISAM;
617+
INSERT INTO t1 VALUES (NULL, 0);
618+
INSERT INTO t1 SELECT NULL, 0 FROM t1;
619+
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
620+
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
621+
explain UPDATE t2, v1 AS t SET t2.b = t.a+5 ;
622+
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
623+
1 UPDATE t2 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
624+
1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index
625+
UPDATE t2, v1 AS t SET t2.b = t.a+5 ;
626+
DROP VIEW v1;
627+
DROP TABLE t1, t2;

mysql-test/t/delete.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,3 +816,17 @@ WHERE OUTR1 . pk <> (
816816
DROP TABLE t1, t2, t3, t4, t5;
817817

818818
SET sql_mode=default;
819+
820+
--echo # Bug#20450013 assertion 'select_lex::having_cond() == __null ...
821+
822+
CREATE TABLE t1(a TEXT, FULLTEXT (a));
823+
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
824+
825+
let $query=
826+
DELETE FROM t1 USING v1,t1;
827+
828+
eval explain $query;
829+
eval $query;
830+
831+
DROP VIEW v1;
832+
DROP TABLE t1;

mysql-test/t/update.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,31 @@ UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
546546
SHOW STATUS LIKE 'HANDLER_UPDATE';
547547
ROLLBACK;
548548
DROP TABLE t1, t2;
549+
550+
--echo # Bug#18439019 Assert in mysql_multi_update with ordered view
551+
552+
CREATE TABLE t1 (
553+
a int unsigned not null auto_increment primary key,
554+
b int unsigned
555+
) ENGINE=MyISAM;
556+
557+
CREATE TABLE t2 (
558+
a int unsigned not null auto_increment primary key,
559+
b int unsigned
560+
) ENGINE=MyISAM;
561+
562+
INSERT INTO t1 VALUES (NULL, 0);
563+
INSERT INTO t1 SELECT NULL, 0 FROM t1;
564+
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
565+
566+
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
567+
568+
let $query=
569+
UPDATE t2, v1 AS t SET t2.b = t.a+5 ;
570+
571+
eval explain $query;
572+
eval $query;
573+
574+
DROP VIEW v1;
575+
DROP TABLE t1, t2;
576+

0 commit comments

Comments
 (0)