Description:
The LOAD DATA INFILE syntax supports a SET clause: [SET col_name = expr,...],
but in mysqlimport there is no reference to this option!
How to repeat:
mysqlimport --help
Observe lack of SET clause option
Suggested fix:
implement the SET clause in mysqlimport params,
ex: mysqlimport --columns="@id,name" --set="id=@id+1,load_date=CURRENT_TIMESTAMP" ...
suggested patch for client/mysqlimport.c:
57c57
< *escaped=0, *opt_columns=0,
---
> *escaped=0, *opt_columns=0, *opt_set=0,
84a85
> {"set", 'T',"Defines the SET clause (comma separated).", &opt_set, &opt_set, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
379a381,382
> if (opt_set)
> end= strmov(strmov(end, " SET "), opt_set);
A temporary fix is to inject the SET clause in the --columns option, ex:
--columns="call_date,line_id) SET filename=(\"file1.txt\""
# notice: leave the parenthesis unbalanced, as it is concatenated as "(" + opt_columns + ")" in mysqlimport.c
Description: The LOAD DATA INFILE syntax supports a SET clause: [SET col_name = expr,...], but in mysqlimport there is no reference to this option! How to repeat: mysqlimport --help Observe lack of SET clause option Suggested fix: implement the SET clause in mysqlimport params, ex: mysqlimport --columns="@id,name" --set="id=@id+1,load_date=CURRENT_TIMESTAMP" ... suggested patch for client/mysqlimport.c: 57c57 < *escaped=0, *opt_columns=0, --- > *escaped=0, *opt_columns=0, *opt_set=0, 84a85 > {"set", 'T',"Defines the SET clause (comma separated).", &opt_set, &opt_set, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 379a381,382 > if (opt_set) > end= strmov(strmov(end, " SET "), opt_set); A temporary fix is to inject the SET clause in the --columns option, ex: --columns="call_date,line_id) SET filename=(\"file1.txt\"" # notice: leave the parenthesis unbalanced, as it is concatenated as "(" + opt_columns + ")" in mysqlimport.c