summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2018-02-26 19:41:04 +0300
committerSergei Golubchik <serg@mariadb.org>2018-06-03 23:25:43 +0200
commitb1efff46cd0c32bd696fb2194306edbdfcd75426 (patch)
treedd590703b0c9bdc16ef1144d879fa07e3519beca
parent486682b1daf8488d93c3763a67671db3a5076d98 (diff)
downloadmariadb-git-b1efff46cd0c32bd696fb2194306edbdfcd75426.tar.gz
Vers cleanups
* Always-false vers_select_conds_t::from_query * Debug helpers Closes #684
-rw-r--r--mysql-test/suite/versioning/r/replace.result6
-rw-r--r--mysql-test/suite/versioning/t/replace.test6
-rw-r--r--sql/sql_select.cc3
-rw-r--r--sql/sql_yacc.yy5
-rw-r--r--sql/table.h9
5 files changed, 10 insertions, 19 deletions
diff --git a/mysql-test/suite/versioning/r/replace.result b/mysql-test/suite/versioning/r/replace.result
index a3bd3239a5e..52db0db429a 100644
--- a/mysql-test/suite/versioning/r/replace.result
+++ b/mysql-test/suite/versioning/r/replace.result
@@ -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
diff --git a/mysql-test/suite/versioning/t/replace.test b/mysql-test/suite/versioning/t/replace.test
index 0a100c66607..a4f7b245988 100644
--- a/mysql-test/suite/versioning/t/replace.test
+++ b/mysql-test/suite/versioning/t/replace.test
@@ -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
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3dfc41ae86c..99437e52c13 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 049b2c0cac9..b53a89ecc94 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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;
}
;
diff --git a/sql/table.h b/sql/table.h
index 7b411f00d21..ea00441fb5e 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1848,7 +1848,6 @@ public:
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;
};