mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-9635: Server crashes in part_of_refkey or assertion `!created && key_to_save < (int)s->keys' failed in TABLE::use_index(int) or with join_cache_level>2
Do not try to create index where ref is for hash join.
This commit is contained in:
parent
5a0fff50f8
commit
75f6067e89
3 changed files with 36 additions and 1 deletions
|
@ -454,3 +454,18 @@ HAVING SQ2_alias1 . col_int_key >= 7
|
|||
1
|
||||
drop table t1;
|
||||
set optimizer_switch=@subselect_innodb_tmp;
|
||||
#
|
||||
# MDEV-9635:Server crashes in part_of_refkey or assertion
|
||||
# `!created && key_to_save < (int)s->keys' failed in
|
||||
# TABLE::use_index(int) or with join_cache_level>2
|
||||
#
|
||||
SET join_cache_level=3;
|
||||
CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES ('foo'),('bar');
|
||||
SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
|
||||
f1 f2
|
||||
set join_cache_level = default;
|
||||
drop view v1;
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -433,3 +433,23 @@ drop table t1;
|
|||
|
||||
|
||||
set optimizer_switch=@subselect_innodb_tmp;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-9635:Server crashes in part_of_refkey or assertion
|
||||
--echo # `!created && key_to_save < (int)s->keys' failed in
|
||||
--echo # TABLE::use_index(int) or with join_cache_level>2
|
||||
--echo #
|
||||
|
||||
SET join_cache_level=3;
|
||||
|
||||
CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES ('foo'),('bar');
|
||||
|
||||
SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
|
||||
|
||||
set join_cache_level = default;
|
||||
drop view v1;
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -9422,7 +9422,7 @@ void JOIN::drop_unused_derived_keys()
|
|||
continue;
|
||||
if (!table->pos_in_table_list->is_materialized_derived())
|
||||
continue;
|
||||
if (table->max_keys > 1)
|
||||
if (table->max_keys > 1 && !tab->is_ref_for_hash_join())
|
||||
table->use_index(tab->ref.key);
|
||||
if (table->s->keys)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue