Commit 4ab5e26d authored by mikael@dator6.(none)'s avatar mikael@dator6.(none)

Disabled ascii-function

parent c7f0c910
drop table if exists t1; drop table if exists t1;
create table t1 (a char(5) character set koi8r)
partition by list (ascii(a) mod 3)
subpartition by hash(ascii(a))
subpartitions 3
(partition p1 values in (1),
partition p2 values in (2),
partition p0 values in (0));
insert into t1 values ('a');
explain partitions select * from t1 where a = 'a';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2_p2sp2 system NULL NULL NULL NULL 1
select * from t1 where a = 'a';
a
a
drop table t1;
create table t1 (a char(5) character set cp1251)
partition by list (ascii(a)) (partition pn values in (null));
drop table t1;
create table t1 (col1 datetime) create table t1 (col1 datetime)
partition by range(datediff(col1,col1)) partition by range(datediff(col1,col1))
(partition p0 values less than (10), partition p1 values less than (30)); (partition p0 values less than (10), partition p1 values less than (30));
drop table t1; drop table t1;
create table t1 (a char(5) character set big5)
partition by list (ascii(a)) (partition pn values in (null));
ERROR HY000: This partition function is not allowed
create table t1 (a char(1))
partition by list(ascii(a))
(partition p1 values in (ascii('i')));
drop table t1;
create table t1 (s1 char(5) character set latin5)
partition by list (ascii(s1))
(partition p1 values in (1));
set names utf8;
drop table t1;
create table t1 (col1 int) create table t1 (col1 int)
partition by range(greatest(col1,10)) partition by range(greatest(col1,10))
(partition p0 values less than (2), partition p1 values less than (6)); (partition p0 values less than (2), partition p1 values less than (6));
......
...@@ -19,6 +19,4 @@ drop table t1; ...@@ -19,6 +19,4 @@ drop table t1;
create table t1 (a varchar(1), primary key (a)) create table t1 (a varchar(1), primary key (a))
partition by list (ascii(a)) partition by list (ascii(a))
(partition p1 values in (65)); (partition p1 values in (65));
insert into t1 values ('A'); ERROR HY000: This partition function is not allowed
replace into t1 values ('A');
drop table t1;
...@@ -600,7 +600,7 @@ ERROR HY000: Partition constant is out of partition function domain ...@@ -600,7 +600,7 @@ ERROR HY000: Partition constant is out of partition function domain
create table t1 (v varchar(12)) create table t1 (v varchar(12))
partition by range (ascii(v)) partition by range (ascii(v))
(partition p0 values less than (10)); (partition p0 values less than (10));
drop table t1; ERROR HY000: This partition function is not allowed
create table t1 (a int) create table t1 (a int)
partition by hash (rand(a)); partition by hash (rand(a));
ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2 ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
......
...@@ -676,24 +676,6 @@ f_int1 f_int2 ...@@ -676,24 +676,6 @@ f_int1 f_int2
8 8 8 8
9 9 9 9
drop table t1; drop table t1;
create table t1 (a char(10) binary)
partition by list(ascii(a))
(partition p1 values in (ascii('a')),
partition p2 values in (ascii('b')),
partition p3 values in (ascii('c')),
partition p4 values in (ascii('d')),
partition p5 values in (ascii('e')));
insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee');
select * from t1 where a>='a' and a <= 'dddd';
a
a
bb
ccc
dddd
explain partitions select * from t1 where a>='a' and a <= 'dddd';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 Using where
drop table t1;
create table t1 (f_int1 integer) partition by list(abs(mod(f_int1,2))) create table t1 (f_int1 integer) partition by list(abs(mod(f_int1,2)))
subpartition by hash(f_int1) subpartitions 2 subpartition by hash(f_int1) subpartitions 2
( (
......
drop table if exists t1; drop table if exists t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 2),('a',3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (b* ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 2),('a',3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
partition by range (ascii(b) * ascii(a))
(partition p0 values less than (2), partition p1 values less than (40000));
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
partition by range (ascii(a) * ascii(b))
(partition p0 values less than (2), partition p1 values less than (40000));
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (ascii(a) * c)
(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (c * ascii(a))
(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
create table t1 (a int unsigned) create table t1 (a int unsigned)
partition by range (a) partition by range (a)
(partition pnull values less than (0), (partition pnull values less than (0),
...@@ -743,45 +709,3 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR ...@@ -743,45 +709,3 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where 1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where
DROP TABLE t1; DROP TABLE t1;
create table t1 (a varchar(20))
partition by range (ascii(a))
(partition p0 values less than (100),
partition p1 values less than maxvalue);
insert into t1 values ("12345678901234567890");
insert into t1 values ("A2345678901234567890");
insert into t1 values ("B2345678901234567890");
insert into t1 values ("1234567890123456789");
insert into t1 values ("1234567890123456");
select * from t1;
a
12345678901234567890
A2345678901234567890
B2345678901234567890
1234567890123456789
1234567890123456
explain partitions select * from t1 where a = "12345678901234567890";
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR
a = "B2345678901234567890" OR
a = "C2345678901234567890";
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a = "01234567890123456";
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
select * from t1 where a = "01234567890123456";
a
select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR
a = "B2345678901234567890" OR
a = "C2345678901234567890";
a
12345678901234567890
A2345678901234567890
B2345678901234567890
select * from t1 where a = "12345678901234567890";
a
12345678901234567890
drop table t1;
...@@ -3,44 +3,11 @@ ...@@ -3,44 +3,11 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
create table t1 (a char(5) character set koi8r)
partition by list (ascii(a) mod 3)
subpartition by hash(ascii(a))
subpartitions 3
(partition p1 values in (1),
partition p2 values in (2),
partition p0 values in (0));
insert into t1 values ('a');
explain partitions select * from t1 where a = 'a';
select * from t1 where a = 'a';
drop table t1;
create table t1 (a char(5) character set cp1251)
partition by list (ascii(a)) (partition pn values in (null));
drop table t1;
create table t1 (col1 datetime) create table t1 (col1 datetime)
partition by range(datediff(col1,col1)) partition by range(datediff(col1,col1))
(partition p0 values less than (10), partition p1 values less than (30)); (partition p0 values less than (10), partition p1 values less than (30));
drop table t1; drop table t1;
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a char(5) character set big5)
partition by list (ascii(a)) (partition pn values in (null));
create table t1 (a char(1))
partition by list(ascii(a))
(partition p1 values in (ascii('i')));
#insert into t1 values ('i');
drop table t1;
create table t1 (s1 char(5) character set latin5)
partition by list (ascii(s1))
(partition p1 values in (1));
set names utf8;
#insert into tn values ('¿¿');
drop table t1;
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED -- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (col1 int) create table t1 (col1 int)
partition by range(greatest(col1,10)) partition by range(greatest(col1,10))
......
...@@ -20,9 +20,10 @@ set names latin1; ...@@ -20,9 +20,10 @@ set names latin1;
select * from t1; select * from t1;
drop table t1; drop table t1;
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a varchar(1), primary key (a)) create table t1 (a varchar(1), primary key (a))
partition by list (ascii(a)) partition by list (ascii(a))
(partition p1 values in (65)); (partition p1 values in (65));
insert into t1 values ('A'); #insert into t1 values ('A');
replace into t1 values ('A'); #replace into t1 values ('A');
drop table t1; #drop table t1;
...@@ -769,10 +769,11 @@ partition by range (a) ...@@ -769,10 +769,11 @@ partition by range (a)
# #
# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work # Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
# #
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (v varchar(12)) create table t1 (v varchar(12))
partition by range (ascii(v)) partition by range (ascii(v))
(partition p0 values less than (10)); (partition p0 values less than (10));
drop table t1; #drop table t1;
-- error 1064 -- error 1064
create table t1 (a int) create table t1 (a int)
......
...@@ -538,17 +538,17 @@ select * from t1 where f_int1 between 5 and 15 order by f_int1; ...@@ -538,17 +538,17 @@ select * from t1 where f_int1 between 5 and 15 order by f_int1;
drop table t1; drop table t1;
# part2: bug in pruning code # part2: bug in pruning code
create table t1 (a char(10) binary) #create table t1 (a char(10) binary)
partition by list(ascii(a)) #partition by list(ascii(a))
(partition p1 values in (ascii('a')), # (partition p1 values in (ascii('a')),
partition p2 values in (ascii('b')), # partition p2 values in (ascii('b')),
partition p3 values in (ascii('c')), # partition p3 values in (ascii('c')),
partition p4 values in (ascii('d')), # partition p4 values in (ascii('d')),
partition p5 values in (ascii('e'))); # partition p5 values in (ascii('e')));
insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee'); #insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee');
select * from t1 where a>='a' and a <= 'dddd'; #select * from t1 where a>='a' and a <= 'dddd';
explain partitions select * from t1 where a>='a' and a <= 'dddd'; #explain partitions select * from t1 where a>='a' and a <= 'dddd';
drop table t1; #drop table t1;
# BUG#18659: Assertion failure when subpartitioning is used and partition is # BUG#18659: Assertion failure when subpartitioning is used and partition is
# "IS NULL" # "IS NULL"
......
...@@ -12,45 +12,45 @@ drop table if exists t1; ...@@ -12,45 +12,45 @@ drop table if exists t1;
# #
# BUG 18198: Various tests for partition functions # BUG 18198: Various tests for partition functions
# #
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) #create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (ascii(a) * b) #partition by range (ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (4000)); #(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 2),('a',3); #insert into t1 values ('a ', 2),('a',3);
drop table t1; #drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) #create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (b* ascii(a) * b) #partition by range (b* ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (4000)); #(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 2),('a',3); #insert into t1 values ('a ', 2),('a',3);
drop table t1; #drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, #create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin) # b varchar(10) charset latin1 collate latin1_bin)
partition by range (ascii(b) * ascii(a)) #partition by range (ascii(b) * ascii(a))
(partition p0 values less than (2), partition p1 values less than (40000)); #(partition p0 values less than (2), partition p1 values less than (40000));
insert into t1 values ('a ', 'b '),('a','b'); #insert into t1 values ('a ', 'b '),('a','b');
drop table t1; #drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, #create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin) # b varchar(10) charset latin1 collate latin1_bin)
partition by range (ascii(a) * ascii(b)) #partition by range (ascii(a) * ascii(b))
(partition p0 values less than (2), partition p1 values less than (40000)); #(partition p0 values less than (2), partition p1 values less than (40000));
insert into t1 values ('a ', 'b '),('a','b'); #insert into t1 values ('a ', 'b '),('a','b');
drop table t1; #drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, #create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int) # b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (ascii(a) * c) #partition by range (ascii(a) * c)
(partition p0 values less than (2), partition p1 values less than (4000)); #(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 'b ', 2),('a','b', 3); #insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1; #drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, #create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int) # b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (c * ascii(a)) #partition by range (c * ascii(a))
(partition p0 values less than (2), partition p1 values less than (4000)); #(partition p0 values less than (2), partition p1 values less than (4000));
insert into t1 values ('a ', 'b ', 2),('a','b', 3); #insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1; #drop table t1;
# #
# More checks for partition pruning # More checks for partition pruning
...@@ -733,29 +733,27 @@ DROP TABLE t1; ...@@ -733,29 +733,27 @@ DROP TABLE t1;
# #
# Bug 18198: Try with a couple of cases using VARCHAR fields in # Bug 18198: Try with a couple of cases using VARCHAR fields in
# partition function. # partition function.
create table t1 (a varchar(20)) #create table t1 (a varchar(20))
partition by range (ascii(a)) #partition by range (ascii(a))
(partition p0 values less than (100), #(partition p0 values less than (100),
partition p1 values less than maxvalue); # partition p1 values less than maxvalue);
insert into t1 values ("12345678901234567890"); #insert into t1 values ("12345678901234567890");
insert into t1 values ("A2345678901234567890"); #insert into t1 values ("A2345678901234567890");
insert into t1 values ("B2345678901234567890"); #insert into t1 values ("B2345678901234567890");
insert into t1 values ("1234567890123456789"); #insert into t1 values ("1234567890123456789");
insert into t1 values ("1234567890123456"); #insert into t1 values ("1234567890123456");
select * from t1; #select * from t1;
explain partitions select * from t1 where a = "12345678901234567890"; #explain partitions select * from t1 where a = "12345678901234567890";
explain partitions select * from t1 where a = "12345678901234567890" OR #explain partitions select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR # a = "A2345678901234567890" OR
a = "B2345678901234567890" OR # a = "B2345678901234567890" OR
a = "C2345678901234567890"; # a = "C2345678901234567890";
explain partitions select * from t1 where a = "01234567890123456"; #explain partitions select * from t1 where a = "01234567890123456";
select * from t1 where a = "01234567890123456"; #select * from t1 where a = "01234567890123456";
select * from t1 where a = "12345678901234567890" OR #select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR # a = "A2345678901234567890" OR
a = "B2345678901234567890" OR # a = "B2345678901234567890" OR
a = "C2345678901234567890"; # a = "C2345678901234567890";
select * from t1 where a = "12345678901234567890"; #select * from t1 where a = "12345678901234567890";
#drop table t1;
drop table t1;
...@@ -832,7 +832,6 @@ public: ...@@ -832,7 +832,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "ascii"; } const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; } void fix_length_and_dec() { max_length=3; }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
}; };
class Item_func_ord :public Item_int_func class Item_func_ord :public Item_int_func
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment