summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/csv.test15
-rw-r--r--mysql-test/t/derived_view.test37
-rw-r--r--mysql-test/t/subselect_sj2.test8
-rw-r--r--mysql-test/t/view.test55
4 files changed, 108 insertions, 7 deletions
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 148964d8d96..768a21912a2 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1820,6 +1820,21 @@ INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
DROP TABLE t1;
+#
+# Bug#970528
+# Server crashes in my_strnncollsp_simple on LEFT JOIN with CSV table,
+# TEXT field
+#
+
+CREATE TABLE t1 ( b TEXT NOT NULL ) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('x'),('y');
+
+CREATE TABLE t2 ( a VARCHAR(1) NOT NULL ) ENGINE=CSV;
+INSERT INTO t2 VALUES ('r'),('t');
+
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t1 LEFT JOIN t2 ON ( b = a );
+drop table t1,t2;
#
# Bug #40814 CSV engine does not parse \X characters when they occur in unquoted fields
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index d1ed2ff5ba6..03d308b6c45 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1380,6 +1380,43 @@ SET SESSION optimizer_switch= @save_optimizer_switch;
DROP VIEW v;
DROP TABLE t1,t2;
+--echo #
+--echo # LP BUG#968720 crash due to converting to materialized and
+--echo # natural join made only once
+--echo #
+
+SET @save968720_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on';
+
+CREATE TABLE t1 (a int, INDEX(a));
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (a int, INDEX(a));
+INSERT INTO t2 VALUES (1), (2);
+
+INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
+t2 AS s2;
+SELECT * FROM t1;
+
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+
+PREPARE stmt FROM "
+INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
+t2 AS s2;
+";
+EXECUTE stmt;
+SELECT * FROM t1;
+EXECUTE stmt;
+SELECT * FROM t1;
+
+drop table t1,t2;
+set optimizer_switch=@save968720_optimizer_switch;
+
+--echo #
+--echo # end of 5.3 tests
+--echo #
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 04d1f9e9d9c..92fc500cf55 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -78,13 +78,7 @@ insert into t3 select
A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
from t0 A, t0 B where B.a <5;
-#
-# InnoDB does not use join buffer here, XtraDB does
-# (despite the comment above which says "no join buffering",
-# because it does not hold when this file is included
-# into subselect_sj2_jcl6.test)
-#
-#--replace_regex /Using join buffer//
+--replace_column 9 #
explain select * from t3 where b in (select a from t0);
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 79c733ed791..6208ae7a057 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4546,6 +4546,61 @@ SELECT * FROM t1 RIGHT JOIN v2 ON ( v2.a = t1.a ) WHERE v2.b IN ( SELECT b FROM
DROP VIEW v2;
DROP TABLE t1, t2, t3;
+--echo #
+--echo # BUG#915222: Valgrind complains or crashes with INSERT SELECT
+--echo # within a trigger that uses a view
+--echo #
+
+CREATE TABLE t1 (a char(1));
+
+CREATE TABLE t2 (d int, e char(1));
+
+INSERT INTO t2 VALUES (13,'z');
+
+CREATE TRIGGER tr AFTER UPDATE ON t2
+ FOR EACH ROW
+ REPLACE INTO t3
+ SELECT f, a AS alias FROM t3, v;
+
+CREATE TABLE t3 (f int, g char(8));
+
+CREATE VIEW v AS SELECT a, e FROM t2, t1;
+
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+
+DROP TRIGGER tr;
+DROP VIEW v;
+DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # BUG#972943: Assertion failure with INSERT SELECT within a trigger
+--echo # that uses derived table and materialized view
+--echo #
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,0), (2,8);
+
+CREATE ALGORITHM=TEMPTABLE VIEW v1
+ AS SELECT * FROM t1;
+
+CREATE TABLE t2 (c int);
+CREATE TABLE t3 (d int, e int);
+
+CREATE TRIGGER tr BEFORE INSERT ON t2 FOR EACH ROW
+ INSERT INTO t3
+ SELECT t1.*
+ FROM (SELECT * FROM t1 WHERE b IN (SELECT b FROM v1)) AS alias1, t1
+ WHERE t1.a = 3 OR t1.a > 5;
+
+INSERT INTO t2 VALUES (1);
+
+DROP TRIGGER tr;
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------