[Commits] d260871fccc: MDEV-18967 Load data in system version with long unique does not work
revision-id: d260871fccc44d92ad8b7dec674a791c46123788 (mariadb-10.4.3-87-gd260871fccc) parent(s): f6166101e0fa3dc354baee7c560ee473cdb59491 author: Sachin committer: Sachin timestamp: 2019-03-19 16:43:43 +0530 message: MDEV-18967 Load data in system version with long unique does not work Update system versioning fields before generaled columns for left out fill_record --- mysql-test/main/long_unique_bugs.result | 9 +++++++++ mysql-test/main/long_unique_bugs.test | 13 +++++++++++++ sql/sql_base.cc | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index 5f15171a4f5..a0850c0b9f2 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -204,3 +204,12 @@ ERROR 23000: Duplicate entry ' drop table t1; CREATE TABLE t1 (a int , unique(a) using hash) PARTITION BY HASH (a) PARTITIONS 2; ERROR HY000: Long unique index is not supported in partition +CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; +INSERT INTO t1 VALUES ('A'); +SELECT * INTO OUTFILE 'load.data' from t1; +LOAD DATA INFILE 'load.data' INTO TABLE t1; +ERROR 23000: Duplicate entry 'A' for key 'data' +select * from t1; +data +A +DROP TABLE t1; diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 674e844a374..d257ab511b9 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -237,3 +237,16 @@ drop table t1; # --error ER_LONG_UNIQUE_IN_PART_FUNC_ERROR CREATE TABLE t1 (a int , unique(a) using hash) PARTITION BY HASH (a) PARTITIONS 2; + +# +# MDEV-18967 Load data in system version with long unique does not work +# +CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; +INSERT INTO t1 VALUES ('A'); +SELECT * INTO OUTFILE 'load.data' from t1; +--error ER_DUP_ENTRY +LOAD DATA INFILE 'load.data' INTO TABLE t1; +select * from t1; +DROP TABLE t1; +--let $datadir= `select @@datadir` +--remove_file $datadir/test/load.data diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 5de8bcc6df6..a7debea0076 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8439,12 +8439,12 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, if (!update && table_arg->default_field && table_arg->update_default_fields(0, ignore_errors)) goto err; + if (table_arg->versioned() && !only_unvers_fields) + table_arg->vers_update_fields(); /* Update virtual fields */ if (table_arg->vfield && table_arg->update_virtual_fields(table_arg->file, VCOL_UPDATE_FOR_WRITE)) goto err; - if (table_arg->versioned() && !only_unvers_fields) - table_arg->vers_update_fields(); thd->abort_on_warning= save_abort_on_warning; thd->no_errors= save_no_errors; DBUG_RETURN(thd->is_error());
participants (1)
-
sachin.setiya@mariadb.com