summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2013-11-11 20:38:04 +0200
committerunknown <sanja@montyprogram.com>2013-11-11 20:38:04 +0200
commitdfed447888e1ab71ec0c80b61459bde6ee6eaf66 (patch)
treeb921c0e431da431f8254f434f720fcc469547269 /mysql-test
parent668a5a4ab814d14f95cfbda7776a1f05246dd52e (diff)
parentc98a054fdeab9c2d3a637cf4fce57a2f9756dcc8 (diff)
downloadmariadb-git-dfed447888e1ab71ec0c80b61459bde6ee6eaf66.tar.gz
merge 5.3->5.5
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_equal.result44
-rw-r--r--mysql-test/r/view.result31
-rw-r--r--mysql-test/t/func_equal.test52
-rw-r--r--mysql-test/t/view.test28
4 files changed, 154 insertions, 1 deletions
diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result
index 4750af6e8d8..02593529a91 100644
--- a/mysql-test/r/func_equal.result
+++ b/mysql-test/r/func_equal.result
@@ -42,3 +42,47 @@ select * from t1 where a in ('4828532208463511553');
a
4828532208463511553
drop table t1;
+#End of 4.1 tests
+#
+# MDEV-5103: server crashed on singular Item_equal
+#
+CREATE TABLE `t1` (
+`tipo` enum('p','r') NOT NULL DEFAULT 'r',
+`arquivo_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+`arquivo_md5` char(32) NOT NULL,
+`conteudo` longblob NOT NULL,
+`usuario` varchar(15) NOT NULL,
+`datahora_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`tipo_arquivo` varchar(255) NOT NULL,
+`nome_arquivo` varchar(255) NOT NULL,
+`tamanho_arquivo` bigint(20) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (`tipo`,`arquivo_id`),
+UNIQUE KEY `tipo` (`tipo`,`arquivo_md5`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+INSERT INTO `t1` (`tipo`, `arquivo_id`, `arquivo_md5`, `conteudo`, `usuario`, `datahora_gmt`, `tipo_arquivo`, `nome_arquivo`, `tamanho_arquivo`) VALUES
+('r', 1, 'ad18832202b199728921807033a8a515', '', 'rspadim', '2013-10-05 13:55:50', '001_cbr643', 'CBR6431677410201314132.ret', 21306);
+CREATE TABLE `t2` (
+`tipo` enum('p','r') NOT NULL DEFAULT 'p',
+`arquivo_id` bigint(20) NOT NULL DEFAULT '0',
+`usuario` varchar(25) NOT NULL,
+`datahora` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`erros` longblob NOT NULL,
+`importados` bigint(20) unsigned NOT NULL DEFAULT '0',
+`n_importados` bigint(20) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (`tipo`,`arquivo_id`,`datahora`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+INSERT INTO `t2` (`tipo`, `arquivo_id`, `usuario`, `datahora`, `erros`, `importados`, `n_importados`) VALUES
+('r', 1, 'rspadim', '2013-10-05 14:25:30', '', 32, 0);
+SELECT
+arquivo_id,usuario,datahora_gmt,tipo_arquivo,nome_arquivo,tamanho_arquivo
+FROM t1 AS a
+WHERE datahora_gmt>='0000-00-00 00:00:00' AND
+datahora_gmt<='2013-10-07 02:59:59' AND tipo='r' AND
+(tipo_arquivo,arquivo_id) NOT IN
+(SELECT tipo_arquivo,arquivo_id
+FROM t2
+WHERE (tipo_arquivo,arquivo_id)=(a.tipo_arquivo,a.arquivo_id))
+ORDER BY arquivo_id DESC;
+arquivo_id usuario datahora_gmt tipo_arquivo nome_arquivo tamanho_arquivo
+drop table t2, t1;
+#End of 5.3 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 6567fb830b1..36716fb2a30 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4921,6 +4921,37 @@ q 1 q
q 1 q
drop view v1;
drop table t1,t2;
+#
+# MDEV-5153: Server crashes in Item_ref::fix_fields on 2nd execution
+# of PS with LEFT JOIN and MERGE view or SELECT SQ
+#
+CREATE TABLE t1 (i1 INT, c1 VARCHAR(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+CREATE TABLE t2 (c2 VARCHAR(6)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('foobar'),('qux');
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1 ) IN ( SELECT c2 FROM t2 ) AND i1 <= 2 ;
+PREPARE stmt FROM 'SELECT * FROM t1 LEFT JOIN v1 ON (v1.i1 = t1.i1)';
+EXECUTE stmt;
+i1 c1 i1 c1
+1 foo NULL NULL
+2 bar NULL NULL
+EXECUTE stmt;
+i1 c1 i1 c1
+1 foo NULL NULL
+2 bar NULL NULL
+drop view v1;
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1, c1 ) IN ( SELECT c2, c2 FROM t2 ) AND i1 <= 2 ;
+EXECUTE stmt;
+i1 c1 i1 c1
+1 foo NULL NULL
+2 bar NULL NULL
+EXECUTE stmt;
+i1 c1 i1 c1
+1 foo NULL NULL
+2 bar NULL NULL
+deallocate prepare stmt;
+drop view v1;
+drop table t1,t2;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test
index 1c219af0254..990b6d8e74e 100644
--- a/mysql-test/t/func_equal.test
+++ b/mysql-test/t/func_equal.test
@@ -43,4 +43,54 @@ select * from t1 where a = '4828532208463511553';
select * from t1 where a in ('4828532208463511553');
drop table t1;
-# End of 4.1 tests
+--echo #End of 4.1 tests
+
+--echo #
+--echo # MDEV-5103: server crashed on singular Item_equal
+--echo #
+
+CREATE TABLE `t1` (
+ `tipo` enum('p','r') NOT NULL DEFAULT 'r',
+ `arquivo_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `arquivo_md5` char(32) NOT NULL,
+ `conteudo` longblob NOT NULL,
+ `usuario` varchar(15) NOT NULL,
+ `datahora_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `tipo_arquivo` varchar(255) NOT NULL,
+ `nome_arquivo` varchar(255) NOT NULL,
+ `tamanho_arquivo` bigint(20) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`tipo`,`arquivo_id`),
+ UNIQUE KEY `tipo` (`tipo`,`arquivo_md5`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+
+INSERT INTO `t1` (`tipo`, `arquivo_id`, `arquivo_md5`, `conteudo`, `usuario`, `datahora_gmt`, `tipo_arquivo`, `nome_arquivo`, `tamanho_arquivo`) VALUES
+ ('r', 1, 'ad18832202b199728921807033a8a515', '', 'rspadim', '2013-10-05 13:55:50', '001_cbr643', 'CBR6431677410201314132.ret', 21306);
+
+
+CREATE TABLE `t2` (
+ `tipo` enum('p','r') NOT NULL DEFAULT 'p',
+ `arquivo_id` bigint(20) NOT NULL DEFAULT '0',
+ `usuario` varchar(25) NOT NULL,
+ `datahora` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `erros` longblob NOT NULL,
+ `importados` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `n_importados` bigint(20) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`tipo`,`arquivo_id`,`datahora`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+
+INSERT INTO `t2` (`tipo`, `arquivo_id`, `usuario`, `datahora`, `erros`, `importados`, `n_importados`) VALUES
+ ('r', 1, 'rspadim', '2013-10-05 14:25:30', '', 32, 0);
+
+SELECT
+arquivo_id,usuario,datahora_gmt,tipo_arquivo,nome_arquivo,tamanho_arquivo
+ FROM t1 AS a
+ WHERE datahora_gmt>='0000-00-00 00:00:00' AND
+ datahora_gmt<='2013-10-07 02:59:59' AND tipo='r' AND
+ (tipo_arquivo,arquivo_id) NOT IN
+ (SELECT tipo_arquivo,arquivo_id
+ FROM t2
+ WHERE (tipo_arquivo,arquivo_id)=(a.tipo_arquivo,a.arquivo_id))
+ ORDER BY arquivo_id DESC;
+
+drop table t2, t1;
+--echo #End of 5.3 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0168344a3d2..6424841e017 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4845,6 +4845,34 @@ SELECT * FROM t2 LEFT JOIN v1 ON ( c=b AND a IN ( 1,6 ) );
drop view v1;
drop table t1,t2;
+--echo #
+--echo # MDEV-5153: Server crashes in Item_ref::fix_fields on 2nd execution
+--echo # of PS with LEFT JOIN and MERGE view or SELECT SQ
+--echo #
+
+CREATE TABLE t1 (i1 INT, c1 VARCHAR(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+
+CREATE TABLE t2 (c2 VARCHAR(6)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('foobar'),('qux');
+
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1 ) IN ( SELECT c2 FROM t2 ) AND i1 <= 2 ;
+
+PREPARE stmt FROM 'SELECT * FROM t1 LEFT JOIN v1 ON (v1.i1 = t1.i1)';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+drop view v1;
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1, c1 ) IN ( SELECT c2, c2 FROM t2 ) AND i1 <= 2 ;
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+drop view v1;
+drop table t1,t2;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------