Debian Codegraph @

mysql-test/suite/parts/inc/partition_decimal.inc

raw
1 eval create table t1 (a decimal(10,4) not null, primary key(a)) engine=$engine
2 partition by key (a) (
3 partition pa1 max_rows=20 min_rows=2,
4 partition pa2 max_rows=30 min_rows=3,
5 partition pa3 max_rows=30 min_rows=4,
6 partition pa4 max_rows=40 min_rows=2);
7 show create table t1;
8 insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567);
9 --sorted_result
10 select * from t1;
11 select * from t1 where a=1234.567;
12 delete from t1 where a=1234.567;
13 --sorted_result
14 select * from t1;
15 drop table t1;
16
17 eval create table t2 (a decimal(18,9) not null, primary key(a)) engine=$engine
18 partition by key (a) partitions 10;
19 show create table t2;
20 insert into t2 values (999999999.999999999), (-999999999.999999999), (-1.5), (-1), (0), (1.5), (1234.567), (-1234.567);
21 --sorted_result
22 select * from t2;
23 select * from t2 where a=1234.567;
24 delete from t2 where a=1234.567;
25 --sorted_result
26 select * from t2;
27 delete from t2;
28 let $count=$maxrows;
29 --echo $count*3 inserts;
30 --disable_query_log
31 begin;
32 while ($count)
33 {
34 eval insert into t2 values ($count);
35 eval insert into t2 values ($count+0.333333333);
36 eval insert into t2 values ($count+0.755555555);
37 dec $count;
38 }
39 commit;
40 --enable_query_log
41 select count(*) from t2;
42 drop table t2;
43
44 # Bug 30577: FLOOR() and CEILING() not usable as partition functions
45 # Partition functions are required to return INT_RESULT; FLOOR() and
46 # CEILING() do not, unless they have an INT or DECIMAL argument.
47
48
49 eval create table t3 (a decimal(18,9) not null, primary key(a)) engine=$engine
50 partition by range (floor(a)) subpartition by key (a) subpartitions 2 (
51 partition pa2 values less than (2),
52 partition pa4 values less than (4),
53 partition pa6 values less than (6),
54 partition pa8 values less than (8),
55 partition pa10 values less than (10)
56 );
57 show create table t3;
58 let $count=9;
59 --echo $count*3 inserts;
60 --disable_query_log
61 begin;
62 while ($count)
63 {
64 eval insert into t3 values ($count);
65 eval insert into t3 values ($count+0.333333333);
66 eval insert into t3 values ($count+0.755555555);
67 dec $count;
68 }
69 commit;
70 --enable_query_log
71 select count(*) from t3;
72 drop table t3;
73
74 eval create table t4 (a decimal(18,9) not null, primary key(a)) engine=$engine
75 partition by list (ceiling(a)) subpartition by key (a) subpartitions 2 (
76 partition pa2 values in (1,2),
77 partition pa4 values in (3,4),
78 partition pa6 values in (5,6),
79 partition pa8 values in (7,8),
80 partition pa10 values in (9,10)
81 );
82 show create table t4;
83 let $count=9;
84 --echo $count*3 inserts;
85 --disable_query_log
86 begin;
87 while ($count)
88 {
89 eval insert into t4 values ($count);
90 eval insert into t4 values ($count+0.333333333);
91 eval insert into t4 values ($count+0.755555555);
92 dec $count;
93 }
94 commit;
95 --enable_query_log
96 select count(*) from t4;
97 drop table t4;