mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
set auto_increment_field_not_null to true to preserve zero values for autoincrement fields during LOAD DATA execution if NO_AUTO_VALUE_ON_ZERO sql mode is set
This commit is contained in:
@ -429,6 +429,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
||||
while ((sql_field= (Item_field*) it++))
|
||||
{
|
||||
Field *field= sql_field->field;
|
||||
if (field == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if (pos == read_info.row_end)
|
||||
{
|
||||
thd->cuted_fields++; /* Not enough fields */
|
||||
@ -520,6 +522,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
||||
length=(uint) (read_info.row_end-pos);
|
||||
Field *field=sql_field->field;
|
||||
|
||||
if (field == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if (!read_info.enclosed &&
|
||||
(enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) ||
|
||||
(length == 1 && read_info.found_null))
|
||||
|
Reference in New Issue
Block a user