Commit 44c6c7a9 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table

SQL_SELECT::check_quick() returns error status only
test_quick_select() returns -1. Fix error handling when lower frames
throw error, but it is ignored by test_quick_select(). Fix return
status for out-of-memory errors which are obviously must be processed
as error in upper frames.
parent 9149017b
...@@ -312,3 +312,10 @@ ERROR 42S22: Unknown column 'xx' in 'field list' ...@@ -312,3 +312,10 @@ ERROR 42S22: Unknown column 'xx' in 'field list'
drop procedure sp; drop procedure sp;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table
#
create or replace table t1 (f point, key(f)) with system versioning engine=myisam;
update t1 set f = null where f = 'foo';
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
...@@ -235,4 +235,14 @@ drop procedure sp; ...@@ -235,4 +235,14 @@ drop procedure sp;
drop view v1; drop view v1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table
--echo #
create or replace table t1 (f point, key(f)) with system versioning engine=myisam;
--error ER_CANT_CREATE_GEOMETRY_OBJECT
update t1 set f = null where f = 'foo';
# cleanup
drop table t1;
source suite/versioning/common_finish.inc; source suite/versioning/common_finish.inc;
...@@ -2386,7 +2386,7 @@ static int fill_used_fields_bitmap(PARAM *param) ...@@ -2386,7 +2386,7 @@ static int fill_used_fields_bitmap(PARAM *param)
force_quick_range is really needed. force_quick_range is really needed.
RETURN RETURN
-1 if impossible select (i.e. certainly no rows will be selected) -1 if error or impossible select (i.e. certainly no rows will be selected)
0 if can't use quick_select 0 if can't use quick_select
1 if found usable ranges and quick select has been successfully created. 1 if found usable ranges and quick select has been successfully created.
*/ */
...@@ -2473,7 +2473,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, ...@@ -2473,7 +2473,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
{ {
thd->no_errors=0; thd->no_errors=0;
free_root(&alloc,MYF(0)); // Return memory & allocator free_root(&alloc,MYF(0)); // Return memory & allocator
DBUG_RETURN(0); // Can't use range DBUG_RETURN(-1); // Error
} }
key_parts= param.key_parts; key_parts= param.key_parts;
...@@ -2524,7 +2524,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, ...@@ -2524,7 +2524,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
{ {
thd->no_errors=0; thd->no_errors=0;
free_root(&alloc,MYF(0)); // Return memory & allocator free_root(&alloc,MYF(0)); // Return memory & allocator
DBUG_RETURN(0); // Can't use range DBUG_RETURN(-1); // Error
} }
thd->mem_root= &alloc; thd->mem_root= &alloc;
...@@ -2561,6 +2561,13 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, ...@@ -2561,6 +2561,13 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
if (tree->type != SEL_TREE::KEY && tree->type != SEL_TREE::KEY_SMALLER) if (tree->type != SEL_TREE::KEY && tree->type != SEL_TREE::KEY_SMALLER)
tree= NULL; tree= NULL;
} }
else if (thd->is_error())
{
thd->no_errors=0;
thd->mem_root= param.old_root;
free_root(&alloc, MYF(0));
DBUG_RETURN(-1);
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment