From a53e087ea9d865bbe1f3a53a90b1683196feb5ba Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 13 Dec 2017 13:22:45 +0400 Subject: MDEV-14628 Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode The fixes for these bugs: Bug#27586 Wrong autoinc value assigned by LOAD DATA in the NO_AUTO_VALUE_ON_ZERO mode Bug#22372 Disable spatial key, load data, enable spatial key, crashes table fixed only LOAD DATA INFILE, but did not fix LOAD XML INFILE. This patch does for LOAD XML FILE what patches for Bug#27586 and Bug#22372 earlier did for LOAD DATA INFILE. 1. Fixing the auto_increment problem: a. table->auto_increment_field_not_null is not set to TRUE anymore when a column does not have a corresponding XML tag. b. Adding "table->auto_increment_field_not_null= false" in the end of read_xml_field(). These two changes resemble the patch for Bug#27586. 2. Fixing the GEOMETRY problem: The result for "reset()" was not tested for errors in read_xml_field(), which made it possible for empty string to sneak into a "GEOMETRY NOT NULL" column when this column does not have a corresponding XML tag with data. After this patch the result of reset() is tested and and an error is returned in such cases. This change effectively resembles the patch for Bug#22372 3. Spliting the code into a new virtual method Field::load_data_set_null(). Rationale: a. To avoid duplicate code in read_sep_field() and read_xml_field(): Changes #1 and #2 made the code handling NULL values for Field exactly the same in read_sep_field() and read_xml_field(). b. To avoid tests for field_type(), which is not friendly to upcoming data type plugins. This change makes it possible for data type plugins to implement their own special way for handling NULL values in LOAD DATA by overriding Field_xxx::load_data_set_null(), like Field_geom and Field_timestamp do. --- mysql-test/std_data/loaddata/mdev14628a.xml | 4 ++++ mysql-test/std_data/loaddata/mdev14628b.xml | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 mysql-test/std_data/loaddata/mdev14628a.xml create mode 100644 mysql-test/std_data/loaddata/mdev14628b.xml (limited to 'mysql-test/std_data') diff --git a/mysql-test/std_data/loaddata/mdev14628a.xml b/mysql-test/std_data/loaddata/mdev14628a.xml new file mode 100644 index 00000000000..34ee7336a5a --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev14628a.xml @@ -0,0 +1,4 @@ + + + + diff --git a/mysql-test/std_data/loaddata/mdev14628b.xml b/mysql-test/std_data/loaddata/mdev14628b.xml new file mode 100644 index 00000000000..2ea02d2a35f --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev14628b.xml @@ -0,0 +1,3 @@ + + + -- cgit v1.2.1