| 1 |
# |
| 2 |
# test keyread on an indexed vcol |
| 3 |
# |
| 4 |
--source include/have_partition.inc |
| 5 |
|
| 6 |
CREATE TABLE t1 ( |
| 7 |
id INT NOT NULL, |
| 8 |
store_id INT NOT NULL, |
| 9 |
x INT GENERATED ALWAYS AS (id + store_id) |
| 10 |
) |
| 11 |
PARTITION BY RANGE (store_id) ( |
| 12 |
PARTITION p0 VALUES LESS THAN (6), |
| 13 |
PARTITION p1 VALUES LESS THAN (11), |
| 14 |
PARTITION p2 VALUES LESS THAN (16), |
| 15 |
PARTITION p3 VALUES LESS THAN (21) |
| 16 |
); |
| 17 |
INSERT t1 (id, store_id) VALUES(1, 2), (3, 4), (3, 12), (4, 18); |
| 18 |
CREATE INDEX idx ON t1(x); |
| 19 |
SELECT x FROM t1; |
| 20 |
DROP TABLE t1; |
| 21 |
|
| 22 |
# |
| 23 |
# MDEV-15626 Assertion on update virtual column in partitioned table |
| 24 |
# |
| 25 |
create table t1 (i int, v int as (i) virtual) |
| 26 |
partition by range columns (i) |
| 27 |
subpartition by hash(v) subpartitions 3 ( |
| 28 |
partition p1 values less than (3), |
| 29 |
partition pn values less than (maxvalue)); |
| 30 |
insert t1 set i= 0; |
| 31 |
set statement sql_mode= '' for update t1 set i= 1, v= 2; |
| 32 |
drop table t1; |
| 33 |
|
| 34 |
--echo # |
| 35 |
--echo # MDEV-18734 ASAN heap-use-after-free in my_strnxfrm_simple_internal upon update on versioned partitioned table |
| 36 |
--echo # |
| 37 |
--echo # Cover queue_fix() in ha_partition::handle_ordered_index_scan() |
| 38 |
create or replace table t1 ( |
| 39 |
x int auto_increment primary key, |
| 40 |
b text, v mediumtext as (b) virtual, |
| 41 |
index (v(10)) |
| 42 |
) partition by range columns (x) ( |
| 43 |
partition p1 values less than (3), |
| 44 |
partition p2 values less than (6), |
| 45 |
partition p3 values less than (9), |
| 46 |
partition p4 values less than (12), |
| 47 |
partition p5 values less than (15), |
| 48 |
partition p6 values less than (17), |
| 49 |
partition p7 values less than (19), |
| 50 |
partition p8 values less than (21), |
| 51 |
partition p9 values less than (23), |
| 52 |
partition p10 values less than (25), |
| 53 |
partition p11 values less than (27), |
| 54 |
partition p12 values less than (29), |
| 55 |
partition p13 values less than (31), |
| 56 |
partition p14 values less than (33), |
| 57 |
partition p15 values less than (35), |
| 58 |
partition pn values less than (maxvalue)); |
| 59 |
insert into t1 (b) values |
| 60 |
(repeat('q', 8192)), (repeat('z', 8192)), (repeat('a', 8192)), (repeat('b', 8192)), |
| 61 |
(repeat('x', 8192)), (repeat('y', 8192)); |
| 62 |
|
| 63 |
insert t1 (b) select b from t1; |
| 64 |
insert t1 (b) select b from t1; |
| 65 |
insert t1 (b) select b from t1; |
| 66 |
insert t1 (b) select b from t1; |
| 67 |
|
| 68 |
select x, left(b, 10), left(v, 10) from t1 where x > 30 and x < 60 order by v; |
| 69 |
update t1 set b= 'bar' where v > 'a' limit 20; |
| 70 |
|
| 71 |
drop table t1; |
| 72 |
|
| 73 |
--echo # Cover return_top_record() in ha_partition::handle_ordered_index_scan() |
| 74 |
create table t1 (x int primary key, b tinytext, v text as (b) virtual) |
| 75 |
partition by range columns (x) ( |
| 76 |
partition p1 values less than (4), |
| 77 |
partition pn values less than (maxvalue)); |
| 78 |
insert into t1 (x, b) values (1, ''), (2, ''), (3, 'a'), (4, 'b'); |
| 79 |
update t1 set b= 'bar' where x > 0 order by v limit 2; |
| 80 |
drop table t1; |
| 81 |
|
| 82 |
--echo # |
| 83 |
--echo # MDEV-28127 EXCHANGE PARTITION with non-matching vcol expression segfault |
| 84 |
--echo # |
| 85 |
set @old_mode= @@sql_mode; |
| 86 |
set sql_mode=''; |
| 87 |
create table t1 (a int, key(a)) partition by range (a) (partition p values less than (1)); |
| 88 |
create table t (a int generated always as (1) virtual, key(a)); |
| 89 |
--error ER_TABLES_DIFFERENT_METADATA |
| 90 |
alter table t1 exchange partition p with table t; |
| 91 |
create or replace table t (a int, key(a)); |
| 92 |
alter table t1 exchange partition p with table t; |
| 93 |
create or replace table t1 (a int generated always as (1) virtual, key(a)) partition by range (a) (partition p values less than (1)); |
| 94 |
create or replace table t (a int generated always as (1) virtual, key(a)); |
| 95 |
alter table t1 exchange partition p with table t; |
| 96 |
create or replace table t (a int generated always as (1) stored, key(a)); |
| 97 |
--error ER_TABLES_DIFFERENT_METADATA |
| 98 |
alter table t1 exchange partition p with table t; |
| 99 |
insert into t values (1); |
| 100 |
drop tables t1, t; |
| 101 |
set sql_mode= @old_mode; |