summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/deer.(none)>2006-12-06 21:45:57 +0400
committerunknown <holyfoot/hf@mysql.com/deer.(none)>2006-12-06 21:45:57 +0400
commitea7d3db0b9d03964dfa498e38ad3612ca8509df0 (patch)
treef13904c0c168668e3c0cec9d60b89555b49c58ae /sql/sql_load.cc
parentfcca7af2d536eae49963ff944c161b9a20bf471b (diff)
downloadmariadb-git-ea7d3db0b9d03964dfa498e38ad3612ca8509df0.tar.gz
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
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc14
1 files changed, 12 insertions, 2 deletions
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,