1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

SQL, Parser: system_time logic and syntax fixes [closes #237]

This commit is contained in:
Aleksey Midenkov
2017-08-08 17:12:16 +03:00
committed by GitHub
parent 53370de103
commit d3d2ea9fd5
25 changed files with 264 additions and 435 deletions

View File

@ -263,8 +263,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (open_and_lock_tables(thd, table_list, TRUE, 0))
DBUG_RETURN(TRUE);
bool truncate_history=
select_lex->vers_conditions.type != FOR_SYSTEM_TIME_UNSPECIFIED;
bool truncate_history= table_list->vers_conditions;
if (truncate_history)
{
TABLE *table= table_list->table;
@ -276,12 +275,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
// trx_sees() in InnoDB reads sys_trx_start
if (!table->versioned_by_sql()) {
if (select_lex->vers_conditions.type == FOR_SYSTEM_TIME_BETWEEN ||
select_lex->vers_conditions.type == FOR_SYSTEM_TIME_FROM_TO)
if (table_list->vers_conditions.type == FOR_SYSTEM_TIME_BETWEEN ||
table_list->vers_conditions.type == FOR_SYSTEM_TIME_FROM_TO)
{
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
}
else if (select_lex->vers_conditions.type == FOR_SYSTEM_TIME_BEFORE)
else if (table_list->vers_conditions.type == FOR_SYSTEM_TIME_BEFORE)
{
bitmap_set_bit(table->read_set, table->vers_end_field()->field_index);
}