Commit f66a3c04 authored by unknown's avatar unknown

Reapplied patch for bug18198

parent db1aa7e8
...@@ -25,7 +25,7 @@ partitions 3 ...@@ -25,7 +25,7 @@ partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1, (partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2, partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3); partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: This partition function is not allowed
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -89,7 +89,7 @@ partitions 3 ...@@ -89,7 +89,7 @@ partitions 3
(partition x1 tablespace ts1, (partition x1 tablespace ts1,
partition x2 tablespace ts2, partition x2 tablespace ts2,
partition x3 tablespace ts3); partition x3 tablespace ts3);
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: This partition function is not allowed
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -422,7 +422,7 @@ partition by range (sin(a)) ...@@ -422,7 +422,7 @@ partition by range (sin(a))
partitions 2 partitions 2
(partition x1 values less than (4), (partition x1 values less than (4),
partition x2 values less than (5)); partition x2 values less than (5));
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: This partition function is not allowed
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -619,4 +619,4 @@ partition by range (a + (select count(*) from t1)) ...@@ -619,4 +619,4 @@ partition by range (a + (select count(*) from t1))
ERROR HY000: This partition function is not allowed ERROR HY000: This partition function is not allowed
create table t1 (a char(10)) create table t1 (a char(10))
partition by hash (extractvalue(a,'a')); partition by hash (extractvalue(a,'a'));
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: This partition function is not allowed
drop table if exists t1; drop table if exists t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin)
partition by hash(length(a))
partitions 10;
insert into t1 values (''),(' '),('a'),('a '),('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 p0 ALL NULL NULL NULL NULL 5 Using where
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 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a='a ' OR a='a';
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
drop table t1;
create table t1 (a int unsigned) create table t1 (a int unsigned)
partition by hash(a div 2) partition by hash(a div 2)
partitions 4; partitions 4;
......
...@@ -10,13 +10,13 @@ subpartition sp01, subpartition sp02)); ...@@ -10,13 +10,13 @@ subpartition sp01, subpartition sp02));
ERROR HY000: Wrong number of subpartitions defined, mismatch with previous setting ERROR HY000: Wrong number of subpartitions defined, mismatch with previous setting
drop table t1; drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2; PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL, `f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL `f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) PARTITIONS 2 */
hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYD
hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1#P#p0.MYI
hello/master-data/test/t1#P#p1.MYD hello/master-data/test/t1#P#p1.MYD
...@@ -29,7 +29,7 @@ Table Create Table ...@@ -29,7 +29,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL, `f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL `f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) PARTITIONS 1 */
hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYD
hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1#P#p0.MYI
hello/master-data/test/t1.frm hello/master-data/test/t1.frm
......
...@@ -677,13 +677,12 @@ f_int1 f_int2 ...@@ -677,13 +677,12 @@ f_int1 f_int2
9 9 9 9
drop table t1; drop table t1;
create table t1 (a char(10) binary) create table t1 (a char(10) binary)
partition by list(length(a)) partition by list(ascii(a))
(partition p1 values in (1), (partition p1 values in (ascii('a')),
partition p2 values in (2), partition p2 values in (ascii('b')),
partition p3 values in (3), partition p3 values in (ascii('c')),
partition p4 values in (4), partition p4 values in (ascii('d')),
partition p5 values in (5) 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';
a a
...@@ -848,22 +847,57 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -848,22 +847,57 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
partition by range((a & 0xFF) << 56) ( partition by range(a) (
partition p0 values less than (0x40 << 56), partition p0 values less than (64),
partition p1 values less than (0x80 << 56), partition p1 values less than (128),
partition p2 values less than (0xFF << 56) partition p2 values less than (255)
);
create table t2 (a int)
partition by range(a+0) (
partition p0 values less than (64),
partition p1 values less than (128),
partition p2 values less than (255)
); );
insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE); insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
insert into t2 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
explain partitions select * from t1 where a=0; explain partitions select * from t1 where a=0;
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 p0 ALL NULL NULL NULL NULL 2 Using where 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t2 where a=0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a=0xFE; explain partitions select * from t1 where a=0xFE;
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 p2 ALL NULL NULL NULL NULL 2 Using where 1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a>0xFE and a<= 0xFF; explain partitions select * from t2 where a=0xFE;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
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 NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t2 where a > 0xFE AND a <= 0xFF;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a < 64 AND a >= 63;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t2 where a < 64 AND a >= 63;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a <= 64 AND a >= 63;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t2 where a <= 64 AND a >= 63;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 Using where
drop table t1; drop table t1;
drop table t2;
create table t1(a bigint unsigned not null) partition by range(a+0) ( create table t1(a bigint unsigned not null) partition by range(a+0) (
partition p1 values less than (10), partition p1 values less than (10),
partition p2 values less than (20), partition p2 values less than (20),
......
drop table if exists t1; drop table if exists 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 (length(a) * b) partition by range (ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (400)); (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* length(a) * b) partition by range (b* ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(b) * length(a)) partition by range (ascii(b) * ascii(a))
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(a) * length(b)) partition by range (ascii(a) * ascii(b))
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(a) * c) partition by range (ascii(a) * c)
(partition p0 values less than (2), partition p1 values less than (400)); (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 * length(a)) partition by range (c * ascii(a))
(partition p0 values less than (2), partition p1 values less than (400)); (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 int unsigned) create table t1 (a int unsigned)
...@@ -109,7 +109,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -109,7 +109,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 1; explain partitions select * from t1 where a > 1;
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 p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -744,7 +744,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -744,7 +744,7 @@ 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)) create table t1 (a varchar(20))
partition by range (crc32(md5(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");
...@@ -761,16 +761,16 @@ B2345678901234567890 ...@@ -761,16 +761,16 @@ B2345678901234567890
1234567890123456 1234567890123456
explain partitions select * from t1 where a = "12345678901234567890"; explain partitions select * from t1 where a = "12345678901234567890";
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 p1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
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";
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 p1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a = "01234567890123456"; explain partitions select * from t1 where a = "01234567890123456";
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 p1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
select * from t1 where a = "01234567890123456"; select * from t1 where a = "01234567890123456";
a a
select * from t1 where a = "12345678901234567890" OR select * from t1 where a = "12345678901234567890" OR
......
...@@ -33,7 +33,7 @@ partitions 2; ...@@ -33,7 +33,7 @@ partitions 2;
# #
# Partition by key list, wrong result type # Partition by key list, wrong result type
# #
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -109,7 +109,7 @@ partitions 3 ...@@ -109,7 +109,7 @@ partitions 3
# #
# Partition by hash, invalid result type # Partition by hash, invalid result type
# #
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -533,7 +533,7 @@ partitions 2 ...@@ -533,7 +533,7 @@ partitions 2
# #
# Partition by range, wrong result type of partition function # Partition by range, wrong result type of partition function
# #
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -790,7 +790,7 @@ partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00'))); ...@@ -790,7 +790,7 @@ partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
create table t1 (a int) create table t1 (a int)
partition by range (a + (select count(*) from t1)) partition by range (a + (select count(*) from t1))
(partition p1 values less than (1)); (partition p1 values less than (1));
-- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR -- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a char(10)) create table t1 (a char(10))
partition by hash (extractvalue(a,'a')); partition by hash (extractvalue(a,'a'));
......
...@@ -9,18 +9,6 @@ ...@@ -9,18 +9,6 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# BUG 18198: Partition functions handling
#
create table t1 (a varchar(10) charset latin1 collate latin1_bin)
partition by hash(length(a))
partitions 10;
insert into t1 values (''),(' '),('a'),('a '),('a ');
explain partitions select * from t1 where a='a ';
explain partitions select * from t1 where a='a';
explain partitions select * from t1 where a='a ' OR a='a';
drop table t1;
# #
# More partition pruning tests, especially on interval walking # More partition pruning tests, especially on interval walking
# #
......
...@@ -20,7 +20,7 @@ subpartition sp01, subpartition sp02)); ...@@ -20,7 +20,7 @@ subpartition sp01, subpartition sp02));
drop table t1; drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2; PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
......
...@@ -539,13 +539,12 @@ drop table t1; ...@@ -539,13 +539,12 @@ 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(length(a)) partition by list(ascii(a))
(partition p1 values in (1), (partition p1 values in (ascii('a')),
partition p2 values in (2), partition p2 values in (ascii('b')),
partition p3 values in (3), partition p3 values in (ascii('c')),
partition p4 values in (4), partition p4 values in (ascii('d')),
partition p5 values in (5) 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';
...@@ -692,19 +691,46 @@ explain partitions select * from t1 where a = 18446744073709551000; ...@@ -692,19 +691,46 @@ explain partitions select * from t1 where a = 18446744073709551000;
explain partitions select * from t1 where a = 18446744073709551613; explain partitions select * from t1 where a = 18446744073709551613;
explain partitions select * from t1 where a = 18446744073709551614; explain partitions select * from t1 where a = 18446744073709551614;
drop table t1; drop table t1;
#
# Test all variants of usage for interval_via_mapping
# and interval_via_walking
#
# t1 will use interval_via_mapping since it uses a
# monotonic function, whereas t2 will use
# interval_via_walking since the intervals are short
# and the function isn't monotonic (it is, but it isn't
# discovered in this version).
#
create table t1 (a int)
partition by range(a) (
partition p0 values less than (64),
partition p1 values less than (128),
partition p2 values less than (255)
);
create table t1 (a int) create table t2 (a int)
partition by range((a & 0xFF) << 56) ( partition by range(a+0) (
partition p0 values less than (0x40 << 56), partition p0 values less than (64),
partition p1 values less than (0x80 << 56), partition p1 values less than (128),
partition p2 values less than (0xFF << 56) partition p2 values less than (255)
); );
insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE); insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
insert into t2 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
explain partitions select * from t1 where a=0; explain partitions select * from t1 where a=0;
explain partitions select * from t2 where a=0;
explain partitions select * from t1 where a=0xFE; explain partitions select * from t1 where a=0xFE;
explain partitions select * from t1 where a>0xFE and a<= 0xFF; explain partitions select * from t2 where a=0xFE;
explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
explain partitions select * from t2 where a > 0xFE AND a <= 0xFF;
explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
explain partitions select * from t1 where a < 64 AND a >= 63;
explain partitions select * from t2 where a < 64 AND a >= 63;
explain partitions select * from t1 where a <= 64 AND a >= 63;
explain partitions select * from t2 where a <= 64 AND a >= 63;
drop table t1; drop table t1;
drop table t2;
create table t1(a bigint unsigned not null) partition by range(a+0) ( create table t1(a bigint unsigned not null) partition by range(a+0) (
partition p1 values less than (10), partition p1 values less than (10),
......
...@@ -13,42 +13,42 @@ drop table if exists t1; ...@@ -13,42 +13,42 @@ 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 (length(a) * b) partition by range (ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (400)); (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* length(a) * b) partition by range (b* ascii(a) * b)
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(b) * length(a)) partition by range (ascii(b) * ascii(a))
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(a) * length(b)) partition by range (ascii(a) * ascii(b))
(partition p0 values less than (2), partition p1 values less than (400)); (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 (length(a) * c) partition by range (ascii(a) * c)
(partition p0 values less than (2), partition p1 values less than (400)); (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 * length(a)) partition by range (c * ascii(a))
(partition p0 values less than (2), partition p1 values less than (400)); (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;
...@@ -734,7 +734,7 @@ DROP TABLE t1; ...@@ -734,7 +734,7 @@ 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 (crc32(md5(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);
......
...@@ -839,8 +839,7 @@ public: ...@@ -839,8 +839,7 @@ public:
german character for double s is equal to 2 s. german character for double s is equal to 2 s.
The default is that an item is not allowed The default is that an item is not allowed
in a partition function. However all mathematical functions, string in a partition function. Allowed functions
manipulation functions, date functions are allowed. Allowed functions
can never depend on server version, they cannot depend on anything can never depend on server version, they cannot depend on anything
related to the environment. They can also only depend on a set of related to the environment. They can also only depend on a set of
fields in the table itself. They cannot depend on other tables and fields in the table itself. They cannot depend on other tables and
...@@ -1425,7 +1424,7 @@ public: ...@@ -1425,7 +1424,7 @@ public:
bool is_null() { return 1; } bool is_null() { return 1; }
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
bool check_partition_func_processor(byte *int_arg) {return FALSE;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
class Item_null_result :public Item_null class Item_null_result :public Item_null
...@@ -1610,6 +1609,7 @@ public: ...@@ -1610,6 +1609,7 @@ public:
uint decimal_precision() const uint decimal_precision() const
{ return (uint)(max_length - test(value < 0)); } { return (uint)(max_length - test(value < 0)); }
bool eq(const Item *, bool binary_cmp) const; bool eq(const Item *, bool binary_cmp) const;
bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
}; };
...@@ -1627,6 +1627,7 @@ public: ...@@ -1627,6 +1627,7 @@ public:
void print(String *str); void print(String *str);
Item_num *neg (); Item_num *neg ();
uint decimal_precision() const { return max_length; } uint decimal_precision() const { return max_length; }
bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
}; };
...@@ -1669,6 +1670,7 @@ public: ...@@ -1669,6 +1670,7 @@ public:
uint decimal_precision() const { return decimal_value.precision(); } uint decimal_precision() const { return decimal_value.precision(); }
bool eq(const Item *, bool binary_cmp) const; bool eq(const Item *, bool binary_cmp) const;
void set_decimal_value(my_decimal *value_par); void set_decimal_value(my_decimal *value_par);
bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
}; };
...@@ -1729,7 +1731,6 @@ public: ...@@ -1729,7 +1731,6 @@ public:
{} {}
void print(String *str) { str->append(func_name); } void print(String *str) { str->append(func_name); }
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
...@@ -1807,7 +1808,7 @@ public: ...@@ -1807,7 +1808,7 @@ public:
void print(String *str); void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call) // to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {} void cleanup() {}
bool check_partition_func_processor(byte *int_arg) {return FALSE;} bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
}; };
...@@ -1822,7 +1823,7 @@ public: ...@@ -1822,7 +1823,7 @@ public:
{} {}
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
void print(String *str) { str->append(func_name); } void print(String *str) { str->append(func_name); }
bool check_partition_func_processor(byte *int_arg) {return TRUE;} bool check_partition_func_processor(byte *bool_arg) { return TRUE;}
}; };
...@@ -1835,7 +1836,6 @@ public: ...@@ -1835,7 +1836,6 @@ public:
&my_charset_bin) &my_charset_bin)
{ max_length=19;} { max_length=19;}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
class Item_empty_string :public Item_string class Item_empty_string :public Item_string
...@@ -1858,7 +1858,6 @@ public: ...@@ -1858,7 +1858,6 @@ public:
unsigned_flag=1; unsigned_flag=1;
} }
enum_field_types field_type() const { return int_field_type; } enum_field_types field_type() const { return int_field_type; }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
...@@ -1882,7 +1881,7 @@ public: ...@@ -1882,7 +1881,7 @@ public:
void cleanup() {} void cleanup() {}
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
virtual Item *safe_charset_converter(CHARSET_INFO *tocs); virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
bool check_partition_func_processor(byte *int_arg) {return FALSE;} bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
}; };
...@@ -2119,7 +2118,6 @@ public: ...@@ -2119,7 +2118,6 @@ public:
} }
Item *clone_item(); Item *clone_item();
virtual Item *real_item() { return ref; } virtual Item *real_item() { return ref; }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
......
...@@ -261,7 +261,6 @@ public: ...@@ -261,7 +261,6 @@ public:
} }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
virtual Item *negated_item(); virtual Item *negated_item();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
bool subst_argument_checker(byte **arg) { return TRUE; } bool subst_argument_checker(byte **arg) { return TRUE; }
}; };
...@@ -273,7 +272,6 @@ public: ...@@ -273,7 +272,6 @@ public:
enum Functype functype() const { return NOT_FUNC; } enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; } const char *func_name() const { return "not"; }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
void print(String *str); void print(String *str);
}; };
...@@ -499,7 +497,6 @@ public: ...@@ -499,7 +497,6 @@ public:
bool is_bool_func() { return 1; } bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
uint decimal_precision() const { return 1; } uint decimal_precision() const { return 1; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -511,7 +508,6 @@ public: ...@@ -511,7 +508,6 @@ public:
optimize_type select_optimize() const { return OPTIMIZE_NONE; } optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "strcmp"; } const char *func_name() const { return "strcmp"; }
void print(String *str) { Item_func::print(str); } void print(String *str) { Item_func::print(str); }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -574,7 +570,6 @@ public: ...@@ -574,7 +570,6 @@ public:
const char *func_name() const { return "ifnull"; } const char *func_name() const { return "ifnull"; }
Field *tmp_table_field(TABLE *table); Field *tmp_table_field(TABLE *table);
uint decimal_precision() const; uint decimal_precision() const;
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -615,7 +610,6 @@ public: ...@@ -615,7 +610,6 @@ public:
void print(String *str) { Item_func::print(str); } void print(String *str) { Item_func::print(str); }
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
bool is_null(); bool is_null();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
/* Functions to handle the optimized IN */ /* Functions to handle the optimized IN */
...@@ -1006,7 +1000,6 @@ public: ...@@ -1006,7 +1000,6 @@ public:
void print(String *str); void print(String *str);
Item *find_item(String *str); Item *find_item(String *str);
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
void cleanup() void cleanup()
{ {
uint i; uint i;
...@@ -1081,7 +1074,6 @@ public: ...@@ -1081,7 +1074,6 @@ public:
bool nulls_in_row(); bool nulls_in_row();
bool is_bool_func() { return 1; } bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
/* Functions used by where clause */ /* Functions used by where clause */
...@@ -1124,7 +1116,6 @@ public: ...@@ -1124,7 +1116,6 @@ public:
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
/* Functions used by HAVING for rewriting IN subquery */ /* Functions used by HAVING for rewriting IN subquery */
...@@ -1151,7 +1142,6 @@ public: ...@@ -1151,7 +1142,6 @@ public:
*/ */
table_map used_tables() const table_map used_tables() const
{ return used_tables_cache | RAND_TABLE_BIT; } { return used_tables_cache | RAND_TABLE_BIT; }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
...@@ -1174,7 +1164,6 @@ public: ...@@ -1174,7 +1164,6 @@ public:
void print(String *str); void print(String *str);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
void top_level_item() { abort_on_null=1; } void top_level_item() { abort_on_null=1; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -1213,7 +1202,6 @@ public: ...@@ -1213,7 +1202,6 @@ public:
const char *func_name() const { return "like"; } const char *func_name() const { return "like"; }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref);
void cleanup(); void cleanup();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
#ifdef USE_REGEX #ifdef USE_REGEX
...@@ -1236,7 +1224,6 @@ public: ...@@ -1236,7 +1224,6 @@ public:
const char *func_name() const { return "regexp"; } const char *func_name() const { return "regexp"; }
void print(String *str) { print_op(str); } void print(String *str) { print_op(str); }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
#else #else
...@@ -1293,7 +1280,6 @@ public: ...@@ -1293,7 +1280,6 @@ public:
Item *transform(Item_transformer transformer, byte *arg); Item *transform(Item_transformer transformer, byte *arg);
void traverse_cond(Cond_traverser, void *arg, traverse_order order); void traverse_cond(Cond_traverser, void *arg, traverse_order order);
void neg_arguments(THD *thd); void neg_arguments(THD *thd);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
bool subst_argument_checker(byte **arg) { return TRUE; } bool subst_argument_checker(byte **arg) { return TRUE; }
Item *compile(Item_analyzer analyzer, byte **arg_p, Item *compile(Item_analyzer analyzer, byte **arg_p,
Item_transformer transformer, byte *arg_t); Item_transformer transformer, byte *arg_t);
......
...@@ -253,7 +253,6 @@ public: ...@@ -253,7 +253,6 @@ public:
void fix_num_length_and_dec(); void fix_num_length_and_dec();
void find_num_type(); void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; } String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -317,7 +316,6 @@ public: ...@@ -317,7 +316,6 @@ public:
{ max_length=args[0]->max_length; unsigned_flag=0; } { max_length=args[0]->max_length; unsigned_flag=0; }
void print(String *str); void print(String *str);
uint decimal_precision() const { return args[0]->decimal_precision(); } uint decimal_precision() const { return args[0]->decimal_precision(); }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -351,7 +349,6 @@ public: ...@@ -351,7 +349,6 @@ public:
void fix_length_and_dec() {}; void fix_length_and_dec() {};
const char *func_name() const { return "decimal_typecast"; } const char *func_name() const { return "decimal_typecast"; }
void print(String *); void print(String *);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -448,6 +445,7 @@ public: ...@@ -448,6 +445,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
void fix_num_length_and_dec(); void fix_num_length_and_dec();
uint decimal_precision() const { return args[0]->decimal_precision(); } uint decimal_precision() const { return args[0]->decimal_precision(); }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -460,6 +458,7 @@ public: ...@@ -460,6 +458,7 @@ public:
my_decimal *decimal_op(my_decimal *); my_decimal *decimal_op(my_decimal *);
const char *func_name() const { return "abs"; } const char *func_name() const { return "abs"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
// A class to handle logarithmic and trigonometric functions // A class to handle logarithmic and trigonometric functions
...@@ -494,7 +493,6 @@ public: ...@@ -494,7 +493,6 @@ public:
Item_func_exp(Item *a) :Item_dec_func(a) {} Item_func_exp(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "exp"; } const char *func_name() const { return "exp"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -504,7 +502,6 @@ public: ...@@ -504,7 +502,6 @@ public:
Item_func_ln(Item *a) :Item_dec_func(a) {} Item_func_ln(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "ln"; } const char *func_name() const { return "ln"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -515,7 +512,6 @@ public: ...@@ -515,7 +512,6 @@ public:
Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "log"; } const char *func_name() const { return "log"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -525,7 +521,6 @@ public: ...@@ -525,7 +521,6 @@ public:
Item_func_log2(Item *a) :Item_dec_func(a) {} Item_func_log2(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "log2"; } const char *func_name() const { return "log2"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -535,7 +530,6 @@ public: ...@@ -535,7 +530,6 @@ public:
Item_func_log10(Item *a) :Item_dec_func(a) {} Item_func_log10(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "log10"; } const char *func_name() const { return "log10"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -545,7 +539,6 @@ public: ...@@ -545,7 +539,6 @@ public:
Item_func_sqrt(Item *a) :Item_dec_func(a) {} Item_func_sqrt(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "sqrt"; } const char *func_name() const { return "sqrt"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -555,7 +548,6 @@ public: ...@@ -555,7 +548,6 @@ public:
Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "pow"; } const char *func_name() const { return "pow"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -565,7 +557,6 @@ public: ...@@ -565,7 +557,6 @@ public:
Item_func_acos(Item *a) :Item_dec_func(a) {} Item_func_acos(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "acos"; } const char *func_name() const { return "acos"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_asin :public Item_dec_func class Item_func_asin :public Item_dec_func
...@@ -574,7 +565,6 @@ public: ...@@ -574,7 +565,6 @@ public:
Item_func_asin(Item *a) :Item_dec_func(a) {} Item_func_asin(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "asin"; } const char *func_name() const { return "asin"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_atan :public Item_dec_func class Item_func_atan :public Item_dec_func
...@@ -584,7 +574,6 @@ public: ...@@ -584,7 +574,6 @@ public:
Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "atan"; } const char *func_name() const { return "atan"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_cos :public Item_dec_func class Item_func_cos :public Item_dec_func
...@@ -593,7 +582,6 @@ public: ...@@ -593,7 +582,6 @@ public:
Item_func_cos(Item *a) :Item_dec_func(a) {} Item_func_cos(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "cos"; } const char *func_name() const { return "cos"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_sin :public Item_dec_func class Item_func_sin :public Item_dec_func
...@@ -602,7 +590,6 @@ public: ...@@ -602,7 +590,6 @@ public:
Item_func_sin(Item *a) :Item_dec_func(a) {} Item_func_sin(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "sin"; } const char *func_name() const { return "sin"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_tan :public Item_dec_func class Item_func_tan :public Item_dec_func
...@@ -611,7 +598,6 @@ public: ...@@ -611,7 +598,6 @@ public:
Item_func_tan(Item *a) :Item_dec_func(a) {} Item_func_tan(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "tan"; } const char *func_name() const { return "tan"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_integer :public Item_int_func class Item_func_integer :public Item_int_func
...@@ -639,6 +625,7 @@ public: ...@@ -639,6 +625,7 @@ public:
longlong int_op(); longlong int_op();
double real_op(); double real_op();
my_decimal *decimal_op(my_decimal *); my_decimal *decimal_op(my_decimal *);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -650,6 +637,7 @@ public: ...@@ -650,6 +637,7 @@ public:
longlong int_op(); longlong int_op();
double real_op(); double real_op();
my_decimal *decimal_op(my_decimal *); my_decimal *decimal_op(my_decimal *);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
/* This handles round and truncate */ /* This handles round and truncate */
...@@ -690,7 +678,6 @@ public: ...@@ -690,7 +678,6 @@ public:
Item_func_sign(Item *a) :Item_int_func(a) {} Item_func_sign(Item *a) :Item_int_func(a) {}
const char *func_name() const { return "sign"; } const char *func_name() const { return "sign"; }
longlong val_int(); longlong val_int();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -705,7 +692,6 @@ public: ...@@ -705,7 +692,6 @@ public:
const char *func_name() const { return name; } const char *func_name() const { return name; }
void fix_length_and_dec() void fix_length_and_dec()
{ decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -723,7 +709,6 @@ public: ...@@ -723,7 +709,6 @@ public:
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
void fix_length_and_dec(); void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; } enum Item_result result_type () const { return cmp_type; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_min :public Item_func_min_max class Item_func_min :public Item_func_min_max
...@@ -749,7 +734,6 @@ public: ...@@ -749,7 +734,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "length"; } const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_bit_length :public Item_func_length class Item_func_bit_length :public Item_func_length
...@@ -769,7 +753,6 @@ public: ...@@ -769,7 +753,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "char_length"; } const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_coercibility :public Item_int_func class Item_func_coercibility :public Item_int_func
...@@ -793,7 +776,6 @@ public: ...@@ -793,7 +776,6 @@ public:
longlong val_int(); longlong val_int();
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -828,7 +810,6 @@ public: ...@@ -828,7 +810,6 @@ public:
Item_func_ord(Item *a) :Item_int_func(a) {} Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int(); longlong val_int();
const char *func_name() const { return "ord"; } const char *func_name() const { return "ord"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_find_in_set :public Item_int_func class Item_func_find_in_set :public Item_int_func
...@@ -842,7 +823,6 @@ public: ...@@ -842,7 +823,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "find_in_set"; } const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ /* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
...@@ -854,7 +834,6 @@ public: ...@@ -854,7 +834,6 @@ public:
Item_func_bit(Item *a) :Item_int_func(a) {} Item_func_bit(Item *a) :Item_int_func(a) {}
void fix_length_and_dec() { unsigned_flag= 1; } void fix_length_and_dec() { unsigned_flag= 1; }
void print(String *str) { print_op(str); } void print(String *str) { print_op(str); }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_bit_or :public Item_func_bit class Item_func_bit_or :public Item_func_bit
...@@ -880,7 +859,6 @@ public: ...@@ -880,7 +859,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "bit_count"; } const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; } void fix_length_and_dec() { max_length=2; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_shift_left :public Item_func_bit class Item_func_shift_left :public Item_func_bit
...@@ -1321,7 +1299,6 @@ public: ...@@ -1321,7 +1299,6 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "inet_aton"; } const char *func_name() const { return "inet_aton"; }
void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;} void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;}
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
......
...@@ -50,7 +50,6 @@ public: ...@@ -50,7 +50,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "md5"; } const char *func_name() const { return "md5"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -94,7 +93,6 @@ public: ...@@ -94,7 +93,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "concat"; } const char *func_name() const { return "concat"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_concat_ws :public Item_str_func class Item_func_concat_ws :public Item_str_func
...@@ -116,7 +114,6 @@ public: ...@@ -116,7 +114,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "reverse"; } const char *func_name() const { return "reverse"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -154,7 +151,6 @@ protected: ...@@ -154,7 +151,6 @@ protected:
public: public:
Item_str_conv(Item *item) :Item_str_func(item) {} Item_str_conv(Item *item) :Item_str_func(item) {}
String *val_str(String *); String *val_str(String *);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -455,7 +451,6 @@ public: ...@@ -455,7 +451,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "soundex"; } const char *func_name() const { return "soundex"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -549,7 +544,6 @@ public: ...@@ -549,7 +544,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "rpad"; } const char *func_name() const { return "rpad"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -562,7 +556,6 @@ public: ...@@ -562,7 +556,6 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "lpad"; } const char *func_name() const { return "lpad"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -577,7 +570,6 @@ public: ...@@ -577,7 +570,6 @@ public:
collation.set(default_charset()); collation.set(default_charset());
max_length= 64; max_length= 64;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -594,7 +586,6 @@ public: ...@@ -594,7 +586,6 @@ public:
decimals=0; decimals=0;
max_length=args[0]->max_length*2*collation.collation->mbmaxlen; max_length=args[0]->max_length*2*collation.collation->mbmaxlen;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_unhex :public Item_str_func class Item_func_unhex :public Item_str_func
...@@ -610,7 +601,6 @@ public: ...@@ -610,7 +601,6 @@ public:
decimals=0; decimals=0;
max_length=(1+args[0]->max_length)/2; max_length=(1+args[0]->max_length)/2;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -634,7 +624,6 @@ public: ...@@ -634,7 +624,6 @@ public:
} }
void print(String *str); void print(String *str);
const char *func_name() const { return "cast_as_binary"; } const char *func_name() const { return "cast_as_binary"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -674,7 +663,6 @@ public: ...@@ -674,7 +663,6 @@ public:
String* val_str(String* str); String* val_str(String* str);
const char *func_name() const { return "inet_ntoa"; } const char *func_name() const { return "inet_ntoa"; }
void fix_length_and_dec() { decimals = 0; max_length=3*8+7; } void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_quote :public Item_str_func class Item_func_quote :public Item_str_func
...@@ -689,7 +677,6 @@ public: ...@@ -689,7 +677,6 @@ public:
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length * 2 + 2; max_length= args[0]->max_length * 2 + 2;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_conv_charset :public Item_str_func class Item_func_conv_charset :public Item_str_func
...@@ -790,7 +777,6 @@ public: ...@@ -790,7 +777,6 @@ public:
const char *func_name() const { return "crc32"; } const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
longlong val_int(); longlong val_int();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_uncompressed_length : public Item_int_func class Item_func_uncompressed_length : public Item_int_func
......
...@@ -38,7 +38,6 @@ public: ...@@ -38,7 +38,6 @@ public:
{ {
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -53,7 +52,6 @@ public: ...@@ -53,7 +52,6 @@ public:
decimals=0; decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -129,6 +127,7 @@ public: ...@@ -129,6 +127,7 @@ public:
max_length=10*my_charset_bin.mbmaxlen; max_length=10*my_charset_bin.mbmaxlen;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
...@@ -224,7 +223,6 @@ public: ...@@ -224,7 +223,6 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_yearweek :public Item_int_func class Item_func_yearweek :public Item_int_func
...@@ -303,6 +301,7 @@ class Item_func_dayname :public Item_func_weekday ...@@ -303,6 +301,7 @@ class Item_func_dayname :public Item_func_weekday
max_length=9*MY_CHARSET_BIN_MB_MAXLEN; max_length=9*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
}; };
...@@ -319,7 +318,6 @@ public: ...@@ -319,7 +318,6 @@ public:
decimals=0; decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN; max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -602,7 +600,6 @@ public: ...@@ -602,7 +600,6 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
uint format_length(const String *format); uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -621,7 +618,6 @@ class Item_func_from_unixtime :public Item_date_func ...@@ -621,7 +618,6 @@ class Item_func_from_unixtime :public Item_date_func
const char *func_name() const { return "from_unixtime"; } const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -685,7 +681,6 @@ public: ...@@ -685,7 +681,6 @@ public:
} }
const char *func_name() const { return "sec_to_time"; } const char *func_name() const { return "sec_to_time"; }
bool result_as_longlong() { return TRUE; } bool result_as_longlong() { return TRUE; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -708,7 +703,6 @@ public: ...@@ -708,7 +703,6 @@ public:
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -763,7 +757,6 @@ public: ...@@ -763,7 +757,6 @@ public:
max_length=args[0]->max_length; max_length=args[0]->max_length;
maybe_null= 1; maybe_null= 1;
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -783,7 +776,6 @@ public: ...@@ -783,7 +776,6 @@ public:
String *val_str(String *a); String *val_str(String *a);
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -885,7 +877,6 @@ public: ...@@ -885,7 +877,6 @@ public:
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
} }
longlong val_int(); longlong val_int();
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -908,7 +899,6 @@ public: ...@@ -908,7 +899,6 @@ public:
} }
void print(String *str); void print(String *str);
const char *func_name() const { return "add_time"; } const char *func_name() const { return "add_time"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
my_decimal *val_decimal(my_decimal *decimal_value) my_decimal *val_decimal(my_decimal *decimal_value)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
...@@ -949,7 +939,6 @@ public: ...@@ -949,7 +939,6 @@ public:
:Item_str_timefunc(a, b ,c) {} :Item_str_timefunc(a, b ,c) {}
String *val_str(String *str); String *val_str(String *str);
const char *func_name() const { return "maketime"; } const char *func_name() const { return "maketime"; }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
class Item_func_microsecond :public Item_int_func class Item_func_microsecond :public Item_int_func
...@@ -981,7 +970,6 @@ public: ...@@ -981,7 +970,6 @@ public:
maybe_null=1; maybe_null=1;
} }
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
...@@ -1028,7 +1016,6 @@ public: ...@@ -1028,7 +1016,6 @@ public:
{ {
return tmp_table_field_from_field_type(table, 1); return tmp_table_field_from_field_type(table, 1);
} }
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
......
...@@ -41,7 +41,6 @@ public: ...@@ -41,7 +41,6 @@ public:
Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {}
const char *func_name() const { return "extractvalue"; } const char *func_name() const { return "extractvalue"; }
String *val_str(String *); String *val_str(String *);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
}; };
......
...@@ -880,7 +880,6 @@ bool partition_info::set_up_charset_field_preps() ...@@ -880,7 +880,6 @@ bool partition_info::set_up_charset_field_preps()
Field *field, **ptr; Field *field, **ptr;
char **char_ptrs; char **char_ptrs;
unsigned i; unsigned i;
bool found;
size_t size; size_t size;
uint tot_fields= 0; uint tot_fields= 0;
uint tot_part_fields= 0; uint tot_part_fields= 0;
...@@ -893,7 +892,6 @@ bool partition_info::set_up_charset_field_preps() ...@@ -893,7 +892,6 @@ bool partition_info::set_up_charset_field_preps()
{ {
ptr= part_field_array; ptr= part_field_array;
/* Set up arrays and buffers for those fields */ /* Set up arrays and buffers for those fields */
i= 0;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
if (field_is_partition_charset(field)) if (field_is_partition_charset(field))
...@@ -929,7 +927,7 @@ bool partition_info::set_up_charset_field_preps() ...@@ -929,7 +927,7 @@ bool partition_info::set_up_charset_field_preps()
} }
part_charset_field_array[i]= NULL; part_charset_field_array[i]= NULL;
} }
if (is_sub_partitioned() && list_of_subpart_fields && if (is_sub_partitioned() && !list_of_subpart_fields &&
check_part_func_fields(subpart_field_array, FALSE)) check_part_func_fields(subpart_field_array, FALSE))
{ {
/* Set up arrays and buffers for those fields */ /* Set up arrays and buffers for those fields */
...@@ -937,7 +935,10 @@ bool partition_info::set_up_charset_field_preps() ...@@ -937,7 +935,10 @@ bool partition_info::set_up_charset_field_preps()
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
if (field_is_partition_charset(field)) if (field_is_partition_charset(field))
{
tot_subpart_fields++; tot_subpart_fields++;
tot_fields++;
}
} }
size= tot_subpart_fields * sizeof(char*); size= tot_subpart_fields * sizeof(char*);
if (!(char_ptrs= (char**)sql_calloc(size))) if (!(char_ptrs= (char**)sql_calloc(size)))
...@@ -953,7 +954,6 @@ bool partition_info::set_up_charset_field_preps() ...@@ -953,7 +954,6 @@ bool partition_info::set_up_charset_field_preps()
i= 0; i= 0;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
unsigned j= 0;
CHARSET_INFO *cs; CHARSET_INFO *cs;
char *field_buf; char *field_buf;
LINT_INIT(field_buf); LINT_INIT(field_buf);
...@@ -962,28 +962,16 @@ bool partition_info::set_up_charset_field_preps() ...@@ -962,28 +962,16 @@ bool partition_info::set_up_charset_field_preps()
continue; continue;
cs= ((Field_str*)field)->charset(); cs= ((Field_str*)field)->charset();
size= field->pack_length(); size= field->pack_length();
found= FALSE;
for (j= 0; j < tot_part_fields; j++)
{
if (field == part_charset_field_array[i])
found= TRUE;
}
if (!found)
{
tot_fields++;
if (!(field_buf= sql_calloc(size))) if (!(field_buf= sql_calloc(size)))
goto error; goto error;
} subpart_charset_field_array[i]= field;
subpart_field_buffers[i++]= field_buf; subpart_field_buffers[i++]= field_buf;
} }
if (!(char_ptrs= (char**)sql_calloc(size))) subpart_charset_field_array[i]= NULL;
goto error;
restore_subpart_field_ptrs= char_ptrs;
} }
if (tot_fields) if (tot_fields)
{ {
uint j,k,l; uint k;
size= tot_fields*sizeof(char**); size= tot_fields*sizeof(char**);
if (!(char_ptrs= (char**)sql_calloc(size))) if (!(char_ptrs= (char**)sql_calloc(size)))
goto error; goto error;
...@@ -1001,11 +989,12 @@ bool partition_info::set_up_charset_field_preps() ...@@ -1001,11 +989,12 @@ bool partition_info::set_up_charset_field_preps()
full_part_field_buffers[i]= part_field_buffers[i]; full_part_field_buffers[i]= part_field_buffers[i];
} }
k= tot_part_fields; k= tot_part_fields;
l= 0;
for (i= 0; i < tot_subpart_fields; i++) for (i= 0; i < tot_subpart_fields; i++)
{ {
uint j;
bool found= FALSE;
field= subpart_charset_field_array[i]; field= subpart_charset_field_array[i];
found= FALSE;
for (j= 0; j < tot_part_fields; j++) for (j= 0; j < tot_part_fields; j++)
{ {
if (field == part_charset_field_array[i]) if (field == part_charset_field_array[i])
...@@ -1013,12 +1002,12 @@ bool partition_info::set_up_charset_field_preps() ...@@ -1013,12 +1002,12 @@ bool partition_info::set_up_charset_field_preps()
} }
if (!found) if (!found)
{ {
full_part_charset_field_array[l]= subpart_charset_field_array[k]; full_part_charset_field_array[k]= subpart_charset_field_array[i];
full_part_field_buffers[l]= subpart_field_buffers[k]; full_part_field_buffers[k]= subpart_field_buffers[i];
k++; l++; k++;
} }
} }
full_part_charset_field_array[tot_fields]= NULL; full_part_charset_field_array[k]= NULL;
} }
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
error: error:
......
...@@ -2890,6 +2890,8 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, ...@@ -2890,6 +2890,8 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
} }
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
if (left_endpoint && !include_endpoint)
part_func_value++;
while (max_part_id > min_part_id) while (max_part_id > min_part_id)
{ {
loc_part_id= (max_part_id + min_part_id + 1) >> 1; loc_part_id= (max_part_id + min_part_id + 1) >> 1;
......
...@@ -3956,8 +3956,7 @@ part_bit_expr: ...@@ -3956,8 +3956,7 @@ part_bit_expr:
} }
Lex->part_info->curr_part_elem->has_null_value= TRUE; Lex->part_info->curr_part_elem->has_null_value= TRUE;
} }
else if (part_expr->result_type() != INT_RESULT && else if (part_expr->result_type() != INT_RESULT)
!part_expr->null_value)
{ {
yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR)); yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR));
YYABORT; YYABORT;
......
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