summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2013-01-22 13:29:59 +0200
committerunknown <sanja@montyprogram.com>2013-01-22 13:29:59 +0200
commit82e39cb1e1637794cc3f7c5049d2d20ce5a32576 (patch)
tree01d95de6dea10214403faf03db10b6dd8873714e /mysql-test
parent193c6f548b3702b4259560c40ca24c1243053388 (diff)
downloadmariadb-git-82e39cb1e1637794cc3f7c5049d2d20ce5a32576.tar.gz
Fixed typo in the function name.
test suite added.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_misc.result33
-rw-r--r--mysql-test/t/func_misc.test19
2 files changed, 52 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 514994ed27c..55b0f9d3c57 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -305,6 +305,39 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
ERROR HY000: Incorrect arguments to NAME_CONST
DROP TABLE t1;
#
+# Test or correct maybe_null of last_value
+#
+CREATE TABLE t1 (a char(2) not null );
+INSERT INTO t1 VALUES (4),(7),(1);
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+CREATE TABLE tv (e char(2) not null ) engine=mysql;
+Warnings:
+Warning 1286 Unknown storage engine 'mysql'
+Warning 1266 Using storage engine MyISAM for table 'tv'
+INSERT INTO tv VALUES (1);
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
+explain extended
+select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))))))
+explain extended
+select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(`test`.`tv`.`e`) = last_value(NULL,'1'))))))))
+set optimizer_switch=@optimizer_switch_save;
+drop view v_merge, vm;
+drop table t1,tv;
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 1f221ce9878..292db69a6e3 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -348,6 +348,25 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
DROP TABLE t1;
+--echo #
+--echo # Test or correct maybe_null of last_value
+--echo #
+CREATE TABLE t1 (a char(2) not null );
+INSERT INTO t1 VALUES (4),(7),(1);
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+CREATE TABLE tv (e char(2) not null ) engine=mysql;
+INSERT INTO tv VALUES (1);
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
+explain extended
+select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
+explain extended
+select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
+set optimizer_switch=@optimizer_switch_save;
+drop view v_merge, vm;
+drop table t1,tv;
+
--echo #
--echo # End of 5.5 tests