Commit 82e39cb1 authored by unknown's avatar unknown

Fixed typo in the function name.

test suite added.
parent 193c6f54
......@@ -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
#
#
......
......@@ -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
......
......@@ -2053,9 +2053,9 @@ public:
enum_field_types field_type() const { return last_value->field_type(); }
bool const_item() const { return 0; }
void evaluate_sideeffects();
void update_uesd_tables()
void update_used_tables()
{
Item_func_last_value::update_used_tables();
Item_func::update_used_tables();
maybe_null= last_value->maybe_null;
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment