1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

SQL: missed FOR SYSTEM_TIME ALL for FOR_SYSTEM_TIME_UNSPECIFIED

[fixes #105]
This commit is contained in:
Aleksey Midenkov
2016-12-22 07:34:33 +00:00
parent 27d9e762a9
commit ea60760e47
4 changed files with 16 additions and 2 deletions

View File

@ -20,6 +20,10 @@ x
2 2
select * from t1; select * from t1;
x x
create or replace view vt1 as select * from t1;
show create view vt1;
View Create View character_set_client collation_connection
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x` from `t1` where `t1`.`sys_trx_end` = 18446744073709551615 for system_time all latin1 latin1_swedish_ci
drop view vt1; drop view vt1;
drop view vt2; drop view vt2;
drop table t1; drop table t1;

View File

@ -19,6 +19,9 @@ select * from vt1;
select * from vt2; select * from vt2;
select * from t1; select * from t1;
create or replace view vt1 as select * from t1;
show create view vt1;
drop view vt1; drop view vt1;
drop view vt2; drop view vt2;
drop table t1; drop table t1;

View File

@ -721,6 +721,7 @@ vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, SELECT_LEX *s
if (query_type == FOR_SYSTEM_TIME_ALL) if (query_type == FOR_SYSTEM_TIME_ALL)
{ {
slex->vers_conditions.unwrapped= true;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
@ -928,6 +929,8 @@ vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, SELECT_LEX *s
thd->restore_active_arena(arena, &backup); thd->restore_active_arena(arena, &backup);
} }
slex->vers_conditions.unwrapped= true;
DBUG_RETURN(0); DBUG_RETURN(0);
#undef newx #undef newx
} }
@ -25548,9 +25551,9 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
str->append(having_value != Item::COND_FALSE ? "1" : "0"); str->append(having_value != Item::COND_FALSE ? "1" : "0");
} }
if (vers_conditions.type != FOR_SYSTEM_TIME_UNSPECIFIED) if (vers_conditions.unwrapped)
{ {
// versioning conditions must be already unwrapped to WHERE clause // versioning conditions are already unwrapped to WHERE clause
str->append(STRING_WITH_LEN(" for system_time all ")); str->append(STRING_WITH_LEN(" for system_time all "));
} }

View File

@ -1857,11 +1857,14 @@ struct vers_select_conds_t
vers_range_unit_t unit; vers_range_unit_t unit;
Item *start, *end; Item *start, *end;
bool unwrapped;
void empty() void empty()
{ {
type= FOR_SYSTEM_TIME_UNSPECIFIED; type= FOR_SYSTEM_TIME_UNSPECIFIED;
unit= UNIT_TIMESTAMP; unit= UNIT_TIMESTAMP;
start= end= NULL; start= end= NULL;
unwrapped= false;
} }
void init( void init(
@ -1874,6 +1877,7 @@ struct vers_select_conds_t
unit= u; unit= u;
start= s; start= s;
end= e; end= e;
unwrapped= false;
} }
}; };