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 /sql/opt_range.cc | |
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.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 13 |
1 files changed, 10 insertions, 3 deletions
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); + } } /* |