Commit e4b86780 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: optimized transformer fix [#365 bug 4]

Affected tests (forced mode):

main.win
main.selectivity_innodb
main.subselect_cache
main.analyze_stmt_orderby

Related to #226 (909867d0).
parent 2305666a
......@@ -52,7 +52,6 @@ select * from t group by b having b=2 system_time as of timestamp now(6);
a b
Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query
Warning 4109 Attempt to read unversioned field `b` in historical query
select a from t where b=2 system_time as of timestamp now(6);
a
Warnings:
......@@ -71,7 +70,6 @@ select count(*), b from t group by b having b=NULL system_time as of timestamp n
count(*) b
Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query
Warning 4109 Attempt to read unversioned field `b` in historical query
select a, b from t;
a b
1 2
......@@ -85,7 +83,6 @@ select * from t for system_time as of timestamp now(6) group by b having b=2;
a b
Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query
Warning 4109 Attempt to read unversioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=2;
a
Warnings:
......@@ -104,7 +101,6 @@ select count(*), b from t for system_time as of timestamp now(6) group by b havi
count(*) b
Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query
Warning 4109 Attempt to read unversioned field `b` in historical query
create or replace table t (
a int,
b int not null without system versioning
......
......@@ -358,9 +358,18 @@ x y
3 1
select * from t1 for system_time all, t2 for system_time all system_time all;
ERROR HY000: Unused clause: 'SYSTEM_TIME'
### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning;
insert into t1 values (0, 0), (0, 0);
select min(i) over (partition by b) as f
from (select i + 0 as i, b from t1) as tt
order by i;
f
0
0
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(27);
call innodb_verify_vtq(28);
No A B C D
1 1 1 1 1
2 1 1 1 1
......@@ -389,6 +398,7 @@ No A B C D
25 1 1 1 1
26 1 1 1 1
27 1 1 1 1
28 1 1 1 1
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
......
......@@ -181,9 +181,16 @@ select * from t1, t2 system_time all;
--error ER_VERS_UNUSED_CLAUSE
select * from t1 for system_time all, t2 for system_time all system_time all;
--echo ### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning;
insert into t1 values (0, 0), (0, 0);
select min(i) over (partition by b) as f
from (select i + 0 as i, b from t1) as tt
order by i;
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(27);
call innodb_verify_vtq(28);
-- source suite/versioning/common_finish.inc
......@@ -1371,13 +1371,13 @@ JOIN::prepare(TABLE_LIST *tables_init,
for (ORDER *ord= order; ord; ord= ord->next)
{
ord->item_ptr= (*ord->item)->transform(thd, transformer, NULL);
ord->item= &ord->item_ptr;
*ord->item= ord->item_ptr;
}
for (ORDER *ord= group_list; ord; ord= ord->next)
{
ord->item_ptr= (*ord->item)->transform(thd, transformer, NULL);
ord->item= &ord->item_ptr;
*ord->item= ord->item_ptr;
}
if (having)
......
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