diff options
author | Nikita Malyavin <nikita.malyavin@mariadb.com> | 2021-07-28 11:07:49 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-28 11:13:24 +0200 |
commit | 9b8e207ce03b2ab7a766348738055be9520561bd (patch) | |
tree | 292d3ddf4182c9c5261bc3eb54dca2cff146b0f7 /mysql-test/suite/gcol | |
parent | fb8be6a631e68c57d36c1a0637033f6827105366 (diff) | |
download | mariadb-git-9b8e207ce03b2ab7a766348738055be9520561bd.tar.gz |
MDEV-26220 Server crashes with indexed by prefix virtual column
Server crashes in Field::register_field_in_read_map upon select from
partitioned table with indexed by prefix virtual column.
After several read-mark fixes a problem has surfaced:
Since KEY (c(10),a) uses only a prefix of c, a new field is created,
duplicated from table->field[3], with a new length. However,
vcol_inco->expr is not copied.
Therefore, (*key_info)->key_part[i].field->vcol_info->expr was left NULL
in ha_partition::index_init().
Solution: initialize vcols before key initialization
Also key initialization is moved to a function.
Diffstat (limited to 'mysql-test/suite/gcol')
-rw-r--r-- | mysql-test/suite/gcol/inc/gcol_partition.inc | 12 | ||||
-rw-r--r-- | mysql-test/suite/gcol/r/gcol_partition_innodb.result | 11 | ||||
-rw-r--r-- | mysql-test/suite/gcol/r/gcol_partition_myisam.result | 11 |
3 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/suite/gcol/inc/gcol_partition.inc b/mysql-test/suite/gcol/inc/gcol_partition.inc index 4e4af4f0023..50a743c0153 100644 --- a/mysql-test/suite/gcol/inc/gcol_partition.inc +++ b/mysql-test/suite/gcol/inc/gcol_partition.inc @@ -169,3 +169,15 @@ CREATE TABLE t1 ( INSERT INTO t1 () VALUES (),(); UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk; DROP TABLE t1; + +--echo # +--echo # MDEV-26220 Server crashes with indexed by prefix virtual column +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b CHAR(20), c CHAR(20) AS (b), + KEY (c(10),a)) PARTITION BY HASH(pk); +INSERT INTO t1 (pk,a,b) VALUES (1,10,'foo'),(2,11,'baz'); +SELECT a FROM t1; + +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/gcol_partition_innodb.result b/mysql-test/suite/gcol/r/gcol_partition_innodb.result index d3f211c9b9a..e61c0a26417 100644 --- a/mysql-test/suite/gcol/r/gcol_partition_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_partition_innodb.result @@ -104,6 +104,17 @@ INSERT INTO t1 () VALUES (),(); UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk; DROP TABLE t1; # +# MDEV-26220 Server crashes with indexed by prefix virtual column +# +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b CHAR(20), c CHAR(20) AS (b), +KEY (c(10),a)) PARTITION BY HASH(pk); +INSERT INTO t1 (pk,a,b) VALUES (1,10,'foo'),(2,11,'baz'); +SELECT a FROM t1; +a +11 +10 +DROP TABLE t1; +# # MDEV-16980 Wrongly set tablename len while opening the # table for purge thread # diff --git a/mysql-test/suite/gcol/r/gcol_partition_myisam.result b/mysql-test/suite/gcol/r/gcol_partition_myisam.result index 75e216f903b..e54b0ad83c6 100644 --- a/mysql-test/suite/gcol/r/gcol_partition_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_partition_myisam.result @@ -101,6 +101,17 @@ KEY (b,d) INSERT INTO t1 () VALUES (),(); UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk; DROP TABLE t1; +# +# MDEV-26220 Server crashes with indexed by prefix virtual column +# +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b CHAR(20), c CHAR(20) AS (b), +KEY (c(10),a)) PARTITION BY HASH(pk); +INSERT INTO t1 (pk,a,b) VALUES (1,10,'foo'),(2,11,'baz'); +SELECT a FROM t1; +a +11 +10 +DROP TABLE t1; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; DROP PROCEDURE IF EXISTS p1; |