Commit 625aa232 authored by Sachin's avatar Sachin

MDEV-18967 Load data in system version with long unique does not work

Update system versioning fields before generated columns for left out
fill_record
parent 1dffa9d9
......@@ -186,3 +186,12 @@ c varchar(5000),
UNIQUE(c,b(64))
) ENGINE=InnoDB;
drop table t1;
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;
......@@ -215,3 +215,16 @@ CREATE TABLE t1 (
UNIQUE(c,b(64))
) ENGINE=InnoDB;
drop table t1;
#
# 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
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment