mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-15965 Invisible columns and LOAD DATA don't work well together:... ER_WARN_TOO_FEW_RECORDS
Fix mysql_load iterator to skip invisible fields.
This commit is contained in:
@ -556,3 +556,64 @@ INSERT INTO t1 (c,t) VALUES ('foo','2000-01-01 00:00:00');
|
|||||||
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
|
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
INSERT INTO t1 SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
create or replace table t1 (a int, b int invisible);
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
select * from t1 into outfile 'f';
|
||||||
|
load data infile 'f' into table t1;
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
load data infile 'f' into table t1 (a,@v) SET b=@v;
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
load data infile 'f' into table t1 (a,@v) SET b=a;
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 NULL
|
||||||
|
2 NULL
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1(a,b) values (1,1),(2,2);
|
||||||
|
select a,b from t1 into outfile 'a';
|
||||||
|
load data infile 'a' into table t1(a,b);
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
load data infile 'a' into table t1 (a,@v) SET b=@v;
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
load data infile 'a' into table t1 (a,@v) SET b=@v+2;
|
||||||
|
select a,b from t1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
1 3
|
||||||
|
2 4
|
||||||
|
drop table t1;
|
||||||
|
@ -246,3 +246,28 @@ CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
|
|||||||
INSERT INTO t1 SELECT * FROM t1;
|
INSERT INTO t1 SELECT * FROM t1;
|
||||||
# Cleanup
|
# Cleanup
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
##LOAD DATA MDEV-15965 Invisible columns and LOAD DATA don't work well
|
||||||
|
## together: ER_WARN_TOO_FEW_RECORDS
|
||||||
|
create or replace table t1 (a int, b int invisible);
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
|
||||||
|
select * from t1 into outfile 'f';
|
||||||
|
load data infile 'f' into table t1;
|
||||||
|
select a,b from t1;
|
||||||
|
load data infile 'f' into table t1 (a,@v) SET b=@v;
|
||||||
|
select a,b from t1;
|
||||||
|
load data infile 'f' into table t1 (a,@v) SET b=a;
|
||||||
|
select a,b from t1;
|
||||||
|
truncate table t1;
|
||||||
|
|
||||||
|
insert into t1(a,b) values (1,1),(2,2);
|
||||||
|
select a,b from t1 into outfile 'a';
|
||||||
|
load data infile 'a' into table t1(a,b);
|
||||||
|
select a,b from t1;
|
||||||
|
load data infile 'a' into table t1 (a,@v) SET b=@v;
|
||||||
|
select a,b from t1;
|
||||||
|
load data infile 'a' into table t1 (a,@v) SET b=@v+2;
|
||||||
|
select a,b from t1;
|
||||||
|
|
||||||
|
#cleanup
|
||||||
|
drop table t1;
|
||||||
|
@ -444,6 +444,9 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
|
|||||||
field_iterator.set(table_list);
|
field_iterator.set(table_list);
|
||||||
for (; !field_iterator.end_of_fields(); field_iterator.next())
|
for (; !field_iterator.end_of_fields(); field_iterator.next())
|
||||||
{
|
{
|
||||||
|
if (field_iterator.field() &&
|
||||||
|
field_iterator.field()->invisible > VISIBLE)
|
||||||
|
continue;
|
||||||
Item *item;
|
Item *item;
|
||||||
if (!(item= field_iterator.create_item(thd)))
|
if (!(item= field_iterator.create_item(thd)))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
Reference in New Issue
Block a user