diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2023-05-03 15:15:37 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2023-05-05 12:45:30 +0300 |
commit | 822dfad630221e1bbb5686b9d95c72e9b50f6b36 (patch) | |
tree | c3602955c04863f81014f0e745e9522f08014c99 /mysql-test/main/derived.test | |
parent | 9c287c0a90fcb6637417bd118f62c78de78f75ee (diff) | |
download | mariadb-git-bb-11.0-MDEV-31022-variant3.tar.gz |
MDEV-31022: SIGSEGV in maria_create from create_internal_tmp_tablebb-11.0-MDEV-31022-variant3
The code in create_internal_tmp_table() didn't take into account that
now temporary (derived) tables may have multiple indexes:
- one index due to duplicate removal
= In this example created by conversion of big-IN(...) into subquery
= this index might be converted into a "unique constraint" if the field(s)
length is too large.
- one index added by derived_with_keys optimization.
Make it handle multiple indexes.
As a consequence of this, remove TABLE_SHARE::uniques and replace it with
per-index HA_UNIQUE_HASH flag.
- TABLE_SHARE::uniques made sense when it referred to the only index in the
table.
- Now, we need to know which of table indexes should be a unique constraint,
so we indicate that as an index flag.
This patch is based on Monty's patch:
Co-Author: Monty <monty@mariadb.org>
Diffstat (limited to 'mysql-test/main/derived.test')
-rw-r--r-- | mysql-test/main/derived.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index e5f01e15821..b26472d41c0 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -1244,5 +1244,29 @@ SELECT a FROM t1 WHERE a IN ( 1, 1, 2, 194 ); drop table t1; --echo # +--echo # MDEV-31022: SIGSEGV in maria_create from create_internal_tmp_table +--echo # keydef incorrectly allocated on the stack in create_internal_tmp_table() +--echo # + +CREATE TABLE t1 (c CHAR(1) NULL) ENGINE=MyISAM; +INSERT INTO t1 (c) VALUES (1); +SET statement + optimizer_where_cost=1, + big_tables=1, + in_predicate_conversion_threshold=2 +FOR +SELECT * FROM t1 WHERE c IN ('',''); + +SET statement + optimizer_where_cost=1, + big_tables=1, + in_predicate_conversion_threshold=2, + sql_mode='' +FOR +SELECT * FROM t1 WHERE c IN ('',''); + +DROP TABLE t1; + +--echo # --echo # End of 11.0 tests --echo # |