diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-04-02 20:48:38 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-04-02 20:48:38 +0300 |
commit | 44c6c7a9236dbbe35e8fda22b36466b6000038d6 (patch) | |
tree | 3e1034cd58bf9b8388ad80e19cc4e991453f0e1d | |
parent | 9149017bb838e9efbef40c5f2807894c38b3412f (diff) | |
download | mariadb-git-44c6c7a9236dbbe35e8fda22b36466b6000038d6.tar.gz |
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.
-rw-r--r-- | mysql-test/suite/versioning/r/update.result | 7 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/update.test | 10 | ||||
-rw-r--r-- | sql/opt_range.cc | 13 |
3 files changed, 27 insertions, 3 deletions
diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index a2ec02a7ec1..f7901d11d2a 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -312,3 +312,10 @@ ERROR 42S22: Unknown column 'xx' in 'field list' drop procedure sp; drop view v1; 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; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 71e946e6c2b..5b0a9eb5c42 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -235,4 +235,14 @@ drop procedure sp; drop view v1; 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; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index bd5f25d67c2..38b52f96704 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2386,7 +2386,7 @@ static int fill_used_fields_bitmap(PARAM *param) force_quick_range is really needed. 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 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, { thd->no_errors=0; free_root(&alloc,MYF(0)); // Return memory & allocator - DBUG_RETURN(0); // Can't use range + DBUG_RETURN(-1); // Error } key_parts= param.key_parts; @@ -2524,7 +2524,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, { thd->no_errors=0; free_root(&alloc,MYF(0)); // Return memory & allocator - DBUG_RETURN(0); // Can't use range + DBUG_RETURN(-1); // Error } thd->mem_root= &alloc; @@ -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) 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); + } } /* |