diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-03-20 13:02:44 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-02-23 17:43:59 +0400 |
commit | 80c3fd184d4eeb66cd520079c3d23595e52cfdc0 (patch) | |
tree | 1785816792a2a8b8616803de27366bd171f425b5 /sql/field.cc | |
parent | 8036ad541e9da4073a6136052e41c22c758b770e (diff) | |
download | mariadb-git-80c3fd184d4eeb66cd520079c3d23595e52cfdc0.tar.gz |
Backporting MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection
This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch"
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index 18f99945645..080cf34c76d 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1375,7 +1375,25 @@ bool Field::load_data_set_no_data(THD *thd, bool fixed_format) { reset(); // Do not use the DEFAULT value if (fixed_format) + { set_notnull(); + /* + We're loading a fixed format file, e.g.: + LOAD DATA INFILE 't1.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; + Suppose the file ended unexpectedly and no data was provided for an + auto-increment column in the current row. + Historically, if sql_mode=NO_AUTO_VALUE_ON_ZERO, then the column value + is set to 0 in such case (the next auto_increment value is not used). + This behaviour was introduced by the fix for "bug#12053" in mysql-4.1. + Note, loading a delimited file works differently: + "no data" is not converted to 0 on NO_AUTO_VALUE_ON_ZERO: + it's considered as equal to setting the column to NULL, + which is then replaced to the next auto_increment value. + This difference seems to be intentional. + */ + if (this == table->next_number_field) + table->auto_increment_field_not_null= true; + } set_has_explicit_value(); // Do not auto-update this field return false; } |