1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Remove ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY

This commit is contained in:
Sergei Golubchik
2018-02-11 18:26:44 +01:00
parent d0f5e56a20
commit 39157fbf05
6 changed files with 3 additions and 115 deletions

View File

@ -16,65 +16,36 @@ select a, b, b+0 from t for system_time as of timestamp now(6);
a b b+0 a b b+0
1 2 2 1 2 2
3 4 4 3 4 4
Warnings:
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6); select * from t for system_time as of timestamp now(6);
a b a b
1 2 1 2
3 4 3 4
Warnings:
Note 4110 Non-versioned field `b` in historical query
select count(*) from t for system_time as of timestamp now(6) group by b; select count(*) from t for system_time as of timestamp now(6) group by b;
count(*) count(*)
1 1
1 1
Warnings:
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b asc; select * from t for system_time as of timestamp now(6) order by b asc;
a b a b
1 2 1 2
3 4 3 4
Warnings:
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b desc; select * from t for system_time as of timestamp now(6) order by b desc;
a b a b
3 4 3 4
1 2 1 2
Warnings:
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by a having a=2; select * from t for system_time as of timestamp now(6) group by a having a=2;
a b a b
Warnings:
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by b having b=2; select * from t for system_time as of timestamp now(6) group by b having b=2;
a b a b
1 2 1 2
Warnings:
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=2; select a from t for system_time as of timestamp now(6) where b=2;
a a
1 1
Warnings:
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=NULL; select a from t for system_time as of timestamp now(6) where b=NULL;
a a
Warnings:
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b is NULL; select a from t for system_time as of timestamp now(6) where b is NULL;
a a
Warnings:
Note 4110 Non-versioned field `b` in historical query
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL; select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
count(*) b count(*) b
Warnings:
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a, b from t; select a, b from t;
a b a b
1 2 1 2
@ -88,10 +59,6 @@ select * from t for system_time as of timestamp now(6);
a b a b
1 2 1 2
3 4 3 4
Warnings:
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) where b is NULL; select * from t for system_time as of timestamp now(6) where b is NULL;
a b a b
Warnings:
Note 4110 Non-versioned field `b` in historical query
drop table t; drop table t;

View File

@ -10626,24 +10626,6 @@ Item_field::excl_dep_on_grouping_fields(st_select_lex *sel)
return find_matching_grouping_field(this, sel) != NULL; return find_matching_grouping_field(this, sel) != NULL;
} }
Item *Item_field::vers_transformer(THD *thd, uchar *)
{
if (!field)
return this;
if (field->vers_update_unversioned() && context &&
field->table->pos_in_table_list &&
field->table->pos_in_table_list->vers_conditions)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY,
ER_THD(thd, ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY),
field_name.str);
}
return this;
}
bool Item_field::vers_trx_id() const bool Item_field::vers_trx_id() const
{ {
DBUG_ASSERT(field); DBUG_ASSERT(field);

View File

@ -1763,8 +1763,6 @@ public:
virtual Item_field *field_for_view_update() { return 0; } virtual Item_field *field_for_view_update() { return 0; }
virtual Item *vers_transformer(THD *thd, uchar *)
{ return this; }
virtual bool vers_trx_id() const virtual bool vers_trx_id() const
{ return false; } { return false; }
virtual Item *neg_transformer(THD *thd) { return NULL; } virtual Item *neg_transformer(THD *thd) { return NULL; }
@ -2928,7 +2926,6 @@ public:
uint32 max_display_length() const { return field->max_display_length(); } uint32 max_display_length() const { return field->max_display_length(); }
Item_field *field_for_view_update() { return this; } Item_field *field_for_view_update() { return this; }
int fix_outer_field(THD *thd, Field **field, Item **reference); int fix_outer_field(THD *thd, Field **field, Item **reference);
virtual Item *vers_transformer(THD *thd, uchar *);
virtual bool vers_trx_id() const; virtual bool vers_trx_id() const;
virtual Item *update_value_transformer(THD *thd, uchar *select_arg); virtual Item *update_value_transformer(THD *thd, uchar *select_arg);
Item *derived_field_transformer_for_having(THD *thd, uchar *arg); Item *derived_field_transformer_for_having(THD *thd, uchar *arg);

View File

@ -7825,8 +7825,8 @@ ER_VERS_FIELD_WRONG_TYPE
ER_VERS_ENGINE_UNSUPPORTED ER_VERS_ENGINE_UNSUPPORTED
eng "Transaction system versioning for %`s is not supported" eng "Transaction system versioning for %`s is not supported"
ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY ER_UNUSED_22
eng "Non-versioned field %`s in historical query" eng "You should never see it"
ER_PARTITION_WRONG_TYPE ER_PARTITION_WRONG_TYPE
eng "Wrong partitioning type, expected type: %`s" eng "Wrong partitioning type, expected type: %`s"

View File

@ -690,46 +690,6 @@ bool vers_select_conds_t::init_from_sysvar(THD *thd)
return false; return false;
} }
inline
void JOIN::vers_check_items()
{
Item_transformer transformer= &Item::vers_transformer;
if (conds)
{
Item *tmp = conds->transform(thd, transformer, NULL);
if (conds != tmp)
conds= tmp;
}
for (ORDER *ord= order; ord; ord= ord->next)
{
Item *tmp= (*ord->item)->transform(thd, transformer, NULL);
if (*ord->item != tmp)
{
ord->item_ptr= tmp;
*ord->item= ord->item_ptr;
}
}
for (ORDER *ord= group_list; ord; ord= ord->next)
{
Item *tmp= (*ord->item)->transform(thd, transformer, NULL);
if (*ord->item != tmp)
{
ord->item_ptr= tmp;
*ord->item= ord->item_ptr;
}
}
if (having)
{
Item *tmp= having->transform(thd, transformer, NULL);
if (having != tmp)
having= tmp;
}
}
int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr) int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr)
{ {
DBUG_ENTER("SELECT_LEX::vers_setup_cond"); DBUG_ENTER("SELECT_LEX::vers_setup_cond");
@ -1143,7 +1103,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
/* /*
TRUE if the SELECT list mixes elements with and without grouping, TRUE if the SELECT list mixes elements with and without grouping,
and there is no GROUP BY clause. Mixing non-aggregated fields with and there is no GROUP BY clause. Mixing non-aggregated fields with
aggregate functions in the SELECT list is a MySQL exptenstion that aggregate functions in the SELECT list is a MySQL extenstion that
is allowed only if the ONLY_FULL_GROUP_BY sql mode is not set. is allowed only if the ONLY_FULL_GROUP_BY sql mode is not set.
*/ */
mixed_implicit_grouping= false; mixed_implicit_grouping= false;
@ -1439,11 +1399,6 @@ JOIN::prepare(TABLE_LIST *tables_init,
if (!procedure && result && result->prepare(fields_list, unit_arg)) if (!procedure && result && result->prepare(fields_list, unit_arg))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
if (!thd->stmt_arena->is_stmt_prepare() && select_lex->versioned_tables > 0)
{
vers_check_items();
}
unit= unit_arg; unit= unit_arg;
if (prepare_stage2()) if (prepare_stage2())
goto err; goto err;
@ -4047,17 +4002,6 @@ void JOIN::exec_inner()
procedure ? procedure_fields_list : *fields, procedure ? procedure_fields_list : *fields,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
{
List_iterator<Item> it(*columns_list);
while (Item *item= it++)
{
Item_transformer transformer= &Item::vers_transformer;
Item *new_item= item->transform(thd, transformer, NULL);
if (new_item) // Item_default_value::transform() may return NULL
it.replace(new_item);
}
}
error= do_select(this, procedure); error= do_select(this, procedure);
/* Accumulate the counts from all join iterations of all join parts. */ /* Accumulate the counts from all join iterations of all join parts. */
thd->inc_examined_row_count(join_examined_rows); thd->inc_examined_row_count(join_examined_rows);

View File

@ -1767,8 +1767,6 @@ private:
void cleanup_item_list(List<Item> &items) const; void cleanup_item_list(List<Item> &items) const;
bool add_having_as_table_cond(JOIN_TAB *tab); bool add_having_as_table_cond(JOIN_TAB *tab);
bool make_aggr_tables_info(); bool make_aggr_tables_info();
void vers_check_items();
}; };
enum enum_with_bush_roots { WITH_BUSH_ROOTS, WITHOUT_BUSH_ROOTS}; enum enum_with_bush_roots { WITH_BUSH_ROOTS, WITHOUT_BUSH_ROOTS};