summaryrefslogtreecommitdiff
path: root/mysql-test/main/update_innodb.test
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2018-03-09 14:05:35 +0200
committerMonty <monty@mariadb.org>2018-03-29 13:59:44 +0300
commita7abddeffa6a760ce948c2dfb007cdf3f1a369d5 (patch)
tree70eb743fa965a17380bbc0ac88ae79ca1075b896 /mysql-test/main/update_innodb.test
parentab1941266c59a19703a74b5593cf3f508a5752d7 (diff)
downloadmariadb-git-a7abddeffa6a760ce948c2dfb007cdf3f1a369d5.tar.gz
Create 'main' test directory and move 't' and 'r' there
Diffstat (limited to 'mysql-test/main/update_innodb.test')
-rw-r--r--mysql-test/main/update_innodb.test77
1 files changed, 77 insertions, 0 deletions
diff --git a/mysql-test/main/update_innodb.test b/mysql-test/main/update_innodb.test
new file mode 100644
index 00000000000..acc8aceab00
--- /dev/null
+++ b/mysql-test/main/update_innodb.test
@@ -0,0 +1,77 @@
+--source include/have_innodb.inc
+
+CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` datetime DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t2` (
+ `c0` varchar(10) NOT NULL,
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`c0`,`c1`),
+ KEY `c1` (`c1`),
+ KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t3` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `c1` datetime NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ `c3` int(4) unsigned NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `c2` (`c2`),
+ KEY `c3` (`c3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t4` (
+ `c1` int(11) NOT NULL,
+ `c2` bigint(20) DEFAULT NULL,
+ `c3` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+ CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
+
+UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
+
+drop view v1;
+drop table t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 (b INT) ENGINE=InnoDB;
+DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 );
+DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 );
+drop view v1;
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt
+--echo #
+
+CREATE TABLE t1 (
+ a_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ b_id INT(20) UNSIGNED NULL DEFAULT NULL,
+ c_id VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY (a_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ b_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c_id VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY (b_id),
+ INDEX idx_c_id (c_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+
+INSERT INTO t1 (b_id, c_id) VALUES (NULL, NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+
+SELECT * FROM t1;
+SELECT t2.b_id FROM t1,t2 WHERE t2.c_id = t1.c_id;
+UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id);
+SELECT * FROM t1;
+drop table t1,t2;