diff --git a/mysql-test/main/partition_exchange.result b/mysql-test/main/partition_exchange.result index 0b7393bca7c..948a7443d17 100644 --- a/mysql-test/main/partition_exchange.result +++ b/mysql-test/main/partition_exchange.result @@ -1250,28 +1250,6 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ERROR HY000: Tables have different definitions DROP TABLE t1, t2; # -# MDEV-34033 Exchange partition with virtual columns fails -# -create or replace table t1( -id int primary key, -col1 int, -col2 boolean as (col1 is null)) -partition by list (id) ( partition p1 values in (1) -); -create or replace table t1_working like t1; -alter table t1_working remove partitioning; -alter table t1 exchange partition p1 with table t1_working; -create or replace table t2( -id int primary key, -col1 int, -col2 boolean as (true)) -partition by list (id) ( partition p1 values in (1) -); -create or replace table t2_working like t2; -alter table t2_working remove partitioning; -alter table t2 exchange partition p1 with table t2_working; -drop tables t1, t1_working, t2, t2_working; -# # MDEV-35612 EXCHANGE PARTITION does not work for tables with unique blobs # create table t (a int, b text, unique (b), unique(a, b)) partition by list (a) (partition p0 values in (1,2), partition pdef default); diff --git a/mysql-test/main/partition_exchange.test b/mysql-test/main/partition_exchange.test index 4bf6ef80fe0..10f863098f9 100644 --- a/mysql-test/main/partition_exchange.test +++ b/mysql-test/main/partition_exchange.test @@ -552,38 +552,6 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; # Cleanup DROP TABLE t1, t2; ---echo # ---echo # MDEV-34033 Exchange partition with virtual columns fails ---echo # -# this fails when the virtual persistent column -# references another column -create or replace table t1( - id int primary key, - col1 int, - col2 boolean as (col1 is null)) - partition by list (id) ( partition p1 values in (1) -); - -create or replace table t1_working like t1; -alter table t1_working remove partitioning; -alter table t1 exchange partition p1 with table t1_working; - -# this works when the virtual persistent column -# does not reference another column -create or replace table t2( - id int primary key, - col1 int, - col2 boolean as (true)) - partition by list (id) ( partition p1 values in (1) -); - -create or replace table t2_working like t2; -alter table t2_working remove partitioning; -alter table t2 exchange partition p1 with table t2_working; - -# Cleanup -drop tables t1, t1_working, t2, t2_working; - --echo # --echo # MDEV-35612 EXCHANGE PARTITION does not work for tables with unique blobs --echo # diff --git a/sql/field.h b/sql/field.h index e6e5c4c1ab7..2928c9966e6 100644 --- a/sql/field.h +++ b/sql/field.h @@ -660,9 +660,6 @@ public: bool fix_and_check_expr(THD *thd, TABLE *table); bool check_access(THD *thd); inline bool is_equal(const Virtual_column_info* vcol) const; - /* Same as is_equal() but for comparing with different table */ - bool is_equivalent(THD *thd, TABLE_SHARE *share, TABLE_SHARE *vcol_share, - const Virtual_column_info* vcol, bool &error) const; inline void print(String*); }; diff --git a/sql/item.cc b/sql/item.cc index 81c040057d1..1ce687238cb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -845,30 +845,6 @@ bool Item_field::rename_fields_processor(void *arg) return 0; } -/** - Rename table and clean field for EXCHANGE comparison -*/ - -bool Item_field::rename_table_processor(void *arg) -{ - Item::func_processor_rename_table *p= (Item::func_processor_rename_table*) arg; - - /* If (db_name, table_name) matches (p->old_db, p->old_table) - rename to (p->new_db, p->new_table) */ - if (((!db_name.str && !p->old_db.str) || - db_name.streq(p->old_db)) && - ((!table_name.str && !p->old_table.str) || - table_name.streq(p->old_table))) - { - db_name= p->new_db; - table_name= p->new_table; - } - - /* Item_field equality is done by field pointer if it is set, we need to avoid that */ - field= NULL; - return 0; -} - /** Check if an Item_field references some field from a list of fields. diff --git a/sql/item.h b/sql/item.h index e711f6d2821..7b28830a50a 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2397,7 +2397,6 @@ public: virtual bool check_partition_func_processor(void *arg) { return true; } virtual bool post_fix_fields_part_expr_processor(void *arg) { return 0; } virtual bool rename_fields_processor(void *arg) { return 0; } - virtual bool rename_table_processor(void *arg) { return 0; } /* TRUE if the function is knowingly TRUE or FALSE. Not to be used for AND/OR formulas. @@ -2426,13 +2425,6 @@ public: LEX_CSTRING table_name; List fields; }; - struct func_processor_rename_table - { - Lex_ident_db old_db; - Lex_ident_table old_table; - Lex_ident_db new_db; - Lex_ident_table new_table; - }; virtual bool check_vcol_func_processor(void *arg) { return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); @@ -3892,7 +3884,6 @@ public: bool switch_to_nullable_fields_processor(void *arg) override; bool update_vcol_processor(void *arg) override; bool rename_fields_processor(void *arg) override; - bool rename_table_processor(void *arg) override; bool check_vcol_func_processor(void *arg) override; bool set_fields_as_dependent_processor(void *arg) override { diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 2fc3c5694f7..d290d0f5534 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -241,8 +241,6 @@ bool compare_table_with_partition(THD *thd, TABLE *table, TABLE *part_table, part_create_info.row_type= table->s->row_type; } - part_create_info.table= part_table; - /* NOTE: ha_blackhole does not support check_if_compatible_data, so this always fail for blackhole tables. diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 089d364e73b..a6c32c337cf 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7522,12 +7522,8 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info, { if (!tmp_new_field->field->vcol_info) DBUG_RETURN(false); - bool err; - if (!field->vcol_info->is_equivalent(thd, table->s, create_info->table->s, - tmp_new_field->field->vcol_info, err)) + if (!field->vcol_info->is_equal(tmp_new_field->field->vcol_info)) DBUG_RETURN(false); - if (err) - DBUG_RETURN(true); } /* diff --git a/sql/table.cc b/sql/table.cc index af9d3f899cf..d744c1c7b4d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3685,27 +3685,6 @@ bool Virtual_column_info::cleanup_session_expr() } -bool -Virtual_column_info::is_equivalent(THD *thd, TABLE_SHARE *share, TABLE_SHARE *vcol_share, - const Virtual_column_info* vcol, bool &error) const -{ - error= true; - Item *cmp_expr= vcol->expr->build_clone(thd); - if (!cmp_expr) - return false; - Item::func_processor_rename_table param; - param.old_db= Lex_ident_db(vcol_share->db); - param.old_table= Lex_ident_table(vcol_share->table_name); - param.new_db= Lex_ident_db(share->db); - param.new_table= Lex_ident_table(share->table_name); - cmp_expr->walk(&Item::rename_table_processor, 1, ¶m); - - error= false; - return type_handler() == vcol->type_handler() - && is_stored() == vcol->is_stored() - && expr->eq(cmp_expr, true); -} - class Vcol_expr_context {