diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 1f9d1076060..9a0c8efb031 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3322,6 +3322,11 @@ VTQ_common::init_hton() hton= plugin_hton(plugin_int_to_ref(innodb_plugin)); DBUG_ASSERT(hton); } + if (hton && !hton->versioned()) + { + my_error(ER_VERS_ENGINE_UNSUPPORTED, MYF(0), Item::name ? Item::name : this->func_name()); + hton= NULL; + } } } @@ -3343,6 +3348,7 @@ Item_func_vtq_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date) if (!hton) return true; + DBUG_ASSERT(hton->vers_query_trx_id); null_value= !hton->vers_query_trx_id(thd, res, trx_id, vtq_field); return false; @@ -3394,6 +3400,7 @@ Item_func_vtq_id::get_by_trx_id(ulonglong trx_id) return 0; } + DBUG_ASSERT(hton->vers_query_trx_id); null_value= !hton->vers_query_trx_id(thd, &res, trx_id, vtq_field); return res; } @@ -3404,6 +3411,7 @@ Item_func_vtq_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards) THD *thd= current_thd; // can it differ from constructor's? DBUG_ASSERT(thd); + DBUG_ASSERT(hton->vers_query_commit_ts); null_value= !hton->vers_query_commit_ts(thd, &cached_result, commit_ts, VTQ_ALL, backwards); if (null_value) { @@ -3516,6 +3524,7 @@ Item_func_vtq_trx_sees::val_int() return true; } + DBUG_ASSERT(hton->vers_trx_sees); bool result= false; null_value= !hton->vers_trx_sees(thd, result, trx_id1, trx_id0, commit_id1, iso_level1, commit_id0); return result; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 19bda09cc39..695c118db4a 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7502,8 +7502,8 @@ ER_VERS_FIELD_WRONG_TYPE ER_VERS_WRONG_PARAMS eng "Wrong parameters for versioned table %`s: %s" -ER_VERS_TRX_ID_UNSUPPORTED - eng "Engine does not support versioned TRX_ID" +ER_VERS_ENGINE_UNSUPPORTED + eng "Engine does not support System Versioning for %`s" ER_VERS_RANGE_UNITS_MISMATCH eng "Range units mismatch" diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4c2ba3caa02..68212eb8fef 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -769,7 +769,7 @@ setup_for_system_time(THD *thd, TABLE_LIST *tables, COND **where_expr, SELECT_LE { if (slex->vers_conditions.unit == UNIT_TRX_ID) { - my_error(ER_VERS_TRX_ID_UNSUPPORTED, MYF(0), table->table_name); + my_error(ER_VERS_ENGINE_UNSUPPORTED, MYF(0), table->table_name); DBUG_RETURN(-1); } }