Commit b1efff46 authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Sergei Golubchik

Vers cleanups

* Always-false vers_select_conds_t::from_query
* Debug helpers

Closes #684
parent 486682b1
......@@ -7,8 +7,7 @@ period for system_time (row_start, row_end)
) with system versioning;
insert t values (1, 2);
replace t values (1, 3);
select *, row_end>TIMESTAMP'2038-01-01 00:00:00' as current from t for system_time all
order by x;
select *, current_row(row_end) as current from t for system_time all order by x;
id x current
1 2 0
1 3 1
......@@ -22,8 +21,7 @@ period for system_time (row_start, row_end)
) with system versioning;
insert t values (1, 2);
replace t values (1, 3);
select *, row_end>TIMESTAMP'2038-01-01 00:00:00' as current from t for system_time all
order by x;
select *, current_row(row_end) as current from t for system_time all order by x;
id x current
1 2 0
1 3 1
......
......@@ -12,8 +12,7 @@ eval create table t (
insert t values (1, 2);
replace t values (1, 3);
select *, row_end>TIMESTAMP'2038-01-01 00:00:00' as current from t for system_time all
order by x;
select *, current_row(row_end) as current from t for system_time all order by x;
drop table t;
--replace_result $sys_datatype_expl SYS_DATATYPE
......@@ -27,8 +26,7 @@ eval create table t (
insert t values (1, 2);
replace t values (1, 3);
select *, row_end>TIMESTAMP'2038-01-01 00:00:00' as current from t for system_time all
order by x;
select *, current_row(row_end) as current from t for system_time all order by x;
drop table t;
--source suite/versioning/common_finish.inc
......@@ -678,7 +678,6 @@ bool vers_select_conds_t::init_from_sysvar(THD *thd)
vers_asof_timestamp_t &in= thd->variables.vers_asof_timestamp;
type= (vers_system_time_t) in.type;
start.unit= VERS_TIMESTAMP;
from_query= false;
if (type != SYSTEM_TIME_UNSPECIFIED && type != SYSTEM_TIME_ALL)
{
DBUG_ASSERT(type == SYSTEM_TIME_AS_OF);
......@@ -741,7 +740,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
{
if (table->table && table->table->versioned())
versioned_tables++;
else if (table->vers_conditions.user_defined() &&
else if (table->vers_conditions.is_set() &&
(table->is_non_derived() || !table->vers_conditions.used))
{
my_error(ER_VERS_NOT_VERSIONED, MYF(0), table->alias.str);
......
......@@ -11788,9 +11788,10 @@ table_primary_ident:
pop_index_hints(),
$3))))
MYSQL_YYABORT;
Select->add_joined_table($$);
TABLE_LIST *tl= $$;
Select->add_joined_table(tl);
if ($4)
$$->vers_conditions= Lex->vers_conditions;
tl->vers_conditions= Lex->vers_conditions;
}
;
......
......@@ -1848,7 +1848,6 @@ class Vers_history_point : public vers_history_point_t
struct vers_select_conds_t
{
vers_system_time_t type;
bool from_query:1;
bool used:1;
Vers_history_point start;
Vers_history_point end;
......@@ -1856,7 +1855,7 @@ struct vers_select_conds_t
void empty()
{
type= SYSTEM_TIME_UNSPECIFIED;
used= from_query= false;
used= false;
start.empty();
end.empty();
}
......@@ -1866,7 +1865,7 @@ struct vers_select_conds_t
Vers_history_point _end= Vers_history_point())
{
type= _type;
used= from_query= false;
used= false;
start= _start;
end= _end;
}
......@@ -1880,10 +1879,6 @@ struct vers_select_conds_t
return type != SYSTEM_TIME_UNSPECIFIED;
}
bool resolve_units(THD *thd);
bool user_defined() const
{
return !from_query && type != SYSTEM_TIME_UNSPECIFIED;
}
bool eq(const vers_select_conds_t &conds) const;
};
......
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