Debian Codegraph @

mysql-test/suite/vcol/r/partition.result

raw
1 CREATE TABLE t1 (
2 id INT NOT NULL,
3 store_id INT NOT NULL,
4 x INT GENERATED ALWAYS AS (id + store_id)
5 )
6 PARTITION BY RANGE (store_id) (
7 PARTITION p0 VALUES LESS THAN (6),
8 PARTITION p1 VALUES LESS THAN (11),
9 PARTITION p2 VALUES LESS THAN (16),
10 PARTITION p3 VALUES LESS THAN (21)
11 );
12 INSERT t1 (id, store_id) VALUES(1, 2), (3, 4), (3, 12), (4, 18);
13 CREATE INDEX idx ON t1(x);
14 SELECT x FROM t1;
15 x
16 3
17 7
18 15
19 22
20 DROP TABLE t1;
21 create table t1 (i int, v int as (i) virtual)
22 partition by range columns (i)
23 subpartition by hash(v) subpartitions 3 (
24 partition p1 values less than (3),
25 partition pn values less than (maxvalue));
26 insert t1 set i= 0;
27 set statement sql_mode= '' for update t1 set i= 1, v= 2;
28 Warnings:
29 Warning 1906 The value specified for generated column 'v' in table 't1' has been ignored
30 drop table t1;
31 #
32 # MDEV-18734 ASAN heap-use-after-free in my_strnxfrm_simple_internal upon update on versioned partitioned table
33 #
34 # Cover queue_fix() in ha_partition::handle_ordered_index_scan()
35 create or replace table t1 (
36 x int auto_increment primary key,
37 b text, v mediumtext as (b) virtual,
38 index (v(10))
39 ) partition by range columns (x) (
40 partition p1 values less than (3),
41 partition p2 values less than (6),
42 partition p3 values less than (9),
43 partition p4 values less than (12),
44 partition p5 values less than (15),
45 partition p6 values less than (17),
46 partition p7 values less than (19),
47 partition p8 values less than (21),
48 partition p9 values less than (23),
49 partition p10 values less than (25),
50 partition p11 values less than (27),
51 partition p12 values less than (29),
52 partition p13 values less than (31),
53 partition p14 values less than (33),
54 partition p15 values less than (35),
55 partition pn values less than (maxvalue));
56 insert into t1 (b) values
57 (repeat('q', 8192)), (repeat('z', 8192)), (repeat('a', 8192)), (repeat('b', 8192)),
58 (repeat('x', 8192)), (repeat('y', 8192));
59 insert t1 (b) select b from t1;
60 insert t1 (b) select b from t1;
61 insert t1 (b) select b from t1;
62 insert t1 (b) select b from t1;
63 select x, left(b, 10), left(v, 10) from t1 where x > 30 and x < 60 order by v;
64 x left(b, 10) left(v, 10)
65 33 aaaaaaaaaa aaaaaaaaaa
66 39 aaaaaaaaaa aaaaaaaaaa
67 45 aaaaaaaaaa aaaaaaaaaa
68 51 aaaaaaaaaa aaaaaaaaaa
69 57 aaaaaaaaaa aaaaaaaaaa
70 34 bbbbbbbbbb bbbbbbbbbb
71 40 bbbbbbbbbb bbbbbbbbbb
72 46 bbbbbbbbbb bbbbbbbbbb
73 52 bbbbbbbbbb bbbbbbbbbb
74 58 bbbbbbbbbb bbbbbbbbbb
75 31 qqqqqqqqqq qqqqqqqqqq
76 37 qqqqqqqqqq qqqqqqqqqq
77 43 qqqqqqqqqq qqqqqqqqqq
78 49 qqqqqqqqqq qqqqqqqqqq
79 55 qqqqqqqqqq qqqqqqqqqq
80 35 xxxxxxxxxx xxxxxxxxxx
81 41 xxxxxxxxxx xxxxxxxxxx
82 47 xxxxxxxxxx xxxxxxxxxx
83 53 xxxxxxxxxx xxxxxxxxxx
84 59 xxxxxxxxxx xxxxxxxxxx
85 36 yyyyyyyyyy yyyyyyyyyy
86 42 yyyyyyyyyy yyyyyyyyyy
87 48 yyyyyyyyyy yyyyyyyyyy
88 54 yyyyyyyyyy yyyyyyyyyy
89 32 zzzzzzzzzz zzzzzzzzzz
90 38 zzzzzzzzzz zzzzzzzzzz
91 44 zzzzzzzzzz zzzzzzzzzz
92 50 zzzzzzzzzz zzzzzzzzzz
93 56 zzzzzzzzzz zzzzzzzzzz
94 Warnings:
95 Warning 4202 29 values were longer than max_sort_length. Sorting used only the first 1024 bytes
96 update t1 set b= 'bar' where v > 'a' limit 20;
97 drop table t1;
98 # Cover return_top_record() in ha_partition::handle_ordered_index_scan()
99 create table t1 (x int primary key, b tinytext, v text as (b) virtual)
100 partition by range columns (x) (
101 partition p1 values less than (4),
102 partition pn values less than (maxvalue));
103 insert into t1 (x, b) values (1, ''), (2, ''), (3, 'a'), (4, 'b');
104 update t1 set b= 'bar' where x > 0 order by v limit 2;
105 drop table t1;
106 #
107 # MDEV-28127 EXCHANGE PARTITION with non-matching vcol expression segfault
108 #
109 set @old_mode= @@sql_mode;
110 set sql_mode='';
111 create table t1 (a int, key(a)) partition by range (a) (partition p values less than (1));
112 create table t (a int generated always as (1) virtual, key(a));
113 alter table t1 exchange partition p with table t;
114 ERROR HY000: Tables have different definitions
115 create or replace table t (a int, key(a));
116 alter table t1 exchange partition p with table t;
117 create or replace table t1 (a int generated always as (1) virtual, key(a)) partition by range (a) (partition p values less than (1));
118 create or replace table t (a int generated always as (1) virtual, key(a));
119 alter table t1 exchange partition p with table t;
120 create or replace table t (a int generated always as (1) stored, key(a));
121 alter table t1 exchange partition p with table t;
122 ERROR HY000: Tables have different definitions
123 insert into t values (1);
124 Warnings:
125 Warning 1906 The value specified for generated column 'a' in table 't' has been ignored
126 drop tables t1, t;
127 set sql_mode= @old_mode;