mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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()
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user