From fa115a0f2cb76106471bb3da0deae805cced557e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Dec 2006 21:45:57 +0400 Subject: bug #22372 (LOAD DATA crashes the table with the geometry field) The problem is that the GEOMETRY NOT NULL can't automatically set any value as a default one. We always tried to complete LOAD DATA command even if there's not enough data in file. That doesn't work for GEOMETRY NOT NULL. Now Field_*::reset() returns an error sign and it's checked in mysql_load() mysql-test/r/gis.result: test result mysql-test/t/gis.test: testcase sql/field.cc: reset() now returns error sign sql/field.h: Field_*::reset() now returns error sign if the field can't be reset sql/sql_load.cc: check if field can't be reset and return error if it's so --- sql/sql_load.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sql/sql_load.cc') diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 48862506729..5710f9c4c97 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -527,7 +527,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, (enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) || (length == 1 && read_info.found_null)) { - field->reset(); + if (field->reset()) + { + my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name, + thd->row_count); + DBUG_RETURN(1); + } field->set_null(); if (!field->maybe_null()) { @@ -560,7 +565,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, for (; sql_field ; sql_field=(Item_field*) it++) { sql_field->field->set_null(); - sql_field->field->reset(); + if (sql_field->field->reset()) + { + my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),sql_field->field->field_name, + thd->row_count); + DBUG_RETURN(1); + } thd->cuted_fields++; push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_TOO_FEW_RECORDS, -- cgit v1.2.1