Commit fbd15d25 authored by mikael/pappa@dator5.(none)'s avatar mikael/pappa@dator5.(none)

Merge dator5.(none):/home/pappa/clean-mysql-5.1

into  dator5.(none):/home/pappa/bug18198
parents ae052828 6425e335
...@@ -750,11 +750,6 @@ t2 CREATE TABLE `t2` ( ...@@ -750,11 +750,6 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a) */ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a) */
drop table t2; drop table t2;
create table t1 (s1 char(2) character set utf8)
partition by list (case when s1 > 'cz' then 1 else 2 end)
(partition p1 values in (1),
partition p2 values in (2));
drop table t1;
create table t1 (f1 int) partition by hash (f1) as select 1; create table t1 (f1 int) partition by hash (f1) as select 1;
drop table t1; drop table t1;
prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)'; prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
......
drop table if exists t1; drop table if exists t1;
create table t1 (a int) create table t1 (a int)
partition by range (a)
(partition p0 values less than ((select count(*) from t1)));
ERROR HY000: This partition function is not allowed
create table t1 (a int)
partition by range (a)
(partition p0 values less than (a);
ERROR 42S22: Unknown column 'a' in 'partition function'
create table t1 (a int)
partition by range (a)
(partition p0 values less than (1));
alter table t1 add partition (partition p1 values less than (a));
ERROR 42S22: Unknown column 'a' in 'partition function'
alter table t1 add partition
(partition p1 values less than ((select count(*) from t1)));
ERROR HY000: This partition function is not allowed
drop table t1;
create table t1 (a int)
engine = x engine = x
partition by key (a); partition by key (a);
Warnings: Warnings:
...@@ -624,7 +641,7 @@ ERROR HY000: Partition constant is out of partition function domain ...@@ -624,7 +641,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
......
...@@ -284,13 +284,6 @@ explain partitions select * from t9 where a <= '2004-12-19'; ...@@ -284,13 +284,6 @@ explain partitions select * from t9 where a <= '2004-12-19';
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 t9 p0,p1 ALL NULL NULL NULL NULL 2 Using where 1 SIMPLE t9 p0,p1 ALL NULL NULL NULL NULL 2 Using where
drop table t5,t6,t7,t8,t9; drop table t5,t6,t7,t8,t9;
create table t1 (a enum('a','b','c','d') default 'a')
partition by hash (ascii(a)) partitions 2;
insert into t1 values ('a'),('b'),('c');
explain partitions select * from t1 where a='b';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
create table t1 ( create table t1 (
a1 int not null a1 int not null
) )
...@@ -683,8 +676,9 @@ f_int1 f_int2 ...@@ -683,8 +676,9 @@ f_int1 f_int2
8 8 8 8
9 9 9 9
drop table t1; drop table t1;
create table t1 (a char(10)) partition by list(length(a)) ( create table t1 (a char(10) binary)
partition p1 values in (1), partition by list(length(a))
(partition p1 values in (1),
partition p2 values in (2), partition p2 values in (2),
partition p3 values in (3), partition p3 values in (3),
partition p4 values in (4), partition p4 values in (4),
......
...@@ -709,3 +709,45 @@ WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR ...@@ -709,3 +709,45 @@ 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 (crc32(md5(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 p1 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 p1 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 p1 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;
...@@ -883,11 +883,13 @@ drop table t2; ...@@ -883,11 +883,13 @@ drop table t2;
# #
# Bug#14367: Partitions: crash if utf8 column # Bug#14367: Partitions: crash if utf8 column
# #
create table t1 (s1 char(2) character set utf8) # utf columns not supported after Bug #18198 is fixed
partition by list (case when s1 > 'cz' then 1 else 2 end) #
(partition p1 values in (1), #create table t1 (s1 char(2) character set utf8)
partition p2 values in (2)); #partition by list (cast(s1 as signed))
drop table t1; #(partition p1 values in (1),
# partition p2 values in (2));
#drop table t1;
# #
# Bug#15336 Partitions: crash if create table as select # Bug#15336 Partitions: crash if create table as select
......
...@@ -8,6 +8,28 @@ ...@@ -8,6 +8,28 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# Bug 18198: Partitions: Too flexible functions
#
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int)
partition by range (a)
(partition p0 values less than ((select count(*) from t1)));
-- error 1054
create table t1 (a int)
partition by range (a)
(partition p0 values less than (a);
create table t1 (a int)
partition by range (a)
(partition p0 values less than (1));
-- error 1054
alter table t1 add partition (partition p1 values less than (a));
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
alter table t1 add partition
(partition p1 values less than ((select count(*) from t1)));
drop table t1;
# #
# Bug 20397: Partitions: Crash when using non-existing engine # Bug 20397: Partitions: Crash when using non-existing engine
# #
...@@ -787,10 +809,10 @@ partition by range (a) ...@@ -787,10 +809,10 @@ 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;
-- error 1064 -- error 1064
create table t1 (a int) create table t1 (a int)
......
...@@ -238,11 +238,14 @@ explain partitions select * from t9 where a <= '2004-12-19'; ...@@ -238,11 +238,14 @@ explain partitions select * from t9 where a <= '2004-12-19';
drop table t5,t6,t7,t8,t9; drop table t5,t6,t7,t8,t9;
# Test the case where we can't create partitioning 'index' # Test the case where we can't create partitioning 'index'
create table t1 (a enum('a','b','c','d') default 'a') #
partition by hash (ascii(a)) partitions 2; # Not supported after bug#18198 is fixed
insert into t1 values ('a'),('b'),('c'); #
explain partitions select * from t1 where a='b'; #create table t1 (a enum('a','b','c','d') default 'a')
drop table t1; # partition by hash (ascii(a)) partitions 2;
#insert into t1 values ('a'),('b'),('c');
#explain partitions select * from t1 where a='b';
#drop table t1;
# #
# Test cases for bugs found in code review: # Test cases for bugs found in code review:
...@@ -535,8 +538,9 @@ select * from t1 where f_int1 between 5 and 15 order by f_int1; ...@@ -535,8 +538,9 @@ 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)) partition by list(length(a)) ( create table t1 (a char(10) binary)
partition p1 values in (1), partition by list(length(a))
(partition p1 values in (1),
partition p2 values in (2), partition p2 values in (2),
partition p3 values in (3), partition p3 values in (3),
partition p4 values in (4), partition p4 values in (4),
......
...@@ -686,3 +686,33 @@ EXPLAIN PARTITIONS SELECT * from t1 ...@@ -686,3 +686,33 @@ EXPLAIN PARTITIONS SELECT * from t1
WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
(a >= '2005-07-01' AND a <= '2005-09-30'); (a >= '2005-07-01' AND a <= '2005-09-30');
DROP TABLE t1; DROP TABLE t1;
#
# Bug 18198: Try with a couple of cases using VARCHAR fields in
# partition function.
create table t1 (a varchar(20))
partition by range (crc32(md5(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;
explain partitions select * from t1 where a = "12345678901234567890";
explain partitions select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR
a = "B2345678901234567890" OR
a = "C2345678901234567890";
explain partitions select * from t1 where a = "01234567890123456";
select * from t1 where a = "01234567890123456";
select * from t1 where a = "12345678901234567890" OR
a = "A2345678901234567890" OR
a = "B2345678901234567890" OR
a = "C2345678901234567890";
select * from t1 where a = "12345678901234567890";
drop table t1;
...@@ -797,7 +797,7 @@ class Item { ...@@ -797,7 +797,7 @@ class Item {
Check if a partition function is allowed Check if a partition function is allowed
SYNOPSIS SYNOPSIS
check_partition_func_processor() check_partition_func_processor()
bool_arg Return argument int_arg Return argument
RETURN VALUE RETURN VALUE
0 0
DESCRIPTION DESCRIPTION
...@@ -814,8 +814,12 @@ class Item { ...@@ -814,8 +814,12 @@ class Item {
whether this should be inherited to the new class. If not the function whether this should be inherited to the new class. If not the function
below should be defined in the new Item class. below should be defined in the new Item class.
*/ */
virtual bool check_partition_func_processor(byte *bool_arg)
{ *(bool *)bool_arg= FALSE; return 0; } virtual bool check_partition_func_processor(byte *int_arg)
{
*(int *)int_arg= 0;
return FALSE;
}
virtual Item *equal_fields_propagator(byte * arg) { return this; } virtual Item *equal_fields_propagator(byte * arg) { return this; }
virtual Item *set_no_const_sub(byte *arg) { return this; } virtual Item *set_no_const_sub(byte *arg) { return this; }
...@@ -1107,7 +1111,6 @@ class Item_name_const : public Item ...@@ -1107,7 +1111,6 @@ class Item_name_const : public Item
Item::maybe_null= TRUE; Item::maybe_null= TRUE;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0; }
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
enum Type type() const; enum Type type() const;
...@@ -1153,7 +1156,7 @@ class Item_num: public Item ...@@ -1153,7 +1156,7 @@ class Item_num: public Item
Item_num() {} /* Remove gcc warning */ Item_num() {} /* Remove gcc warning */
virtual Item_num *neg()= 0; virtual Item_num *neg()= 0;
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
#define NO_CACHED_FIELD_INDEX ((uint)(-1)) #define NO_CACHED_FIELD_INDEX ((uint)(-1))
...@@ -1311,7 +1314,7 @@ class Item_field :public Item_ident ...@@ -1311,7 +1314,7 @@ class Item_field :public Item_ident
bool collect_item_field_processor(byte * arg); bool collect_item_field_processor(byte * arg);
bool find_item_in_field_list_processor(byte *arg); bool find_item_in_field_list_processor(byte *arg);
bool register_field_in_read_map(byte *arg); bool register_field_in_read_map(byte *arg);
bool check_partition_func_processor(byte *bool_arg) { return 0; } bool check_partition_func_processor(byte *int_arg) { return FALSE; }
void cleanup(); void cleanup();
bool result_as_longlong() bool result_as_longlong()
{ {
...@@ -1359,7 +1362,7 @@ class Item_null :public Item ...@@ -1359,7 +1362,7 @@ class Item_null :public Item
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
class Item_null_result :public Item_null class Item_null_result :public Item_null
...@@ -1372,8 +1375,8 @@ class Item_null_result :public Item_null ...@@ -1372,8 +1375,8 @@ class Item_null_result :public Item_null
{ {
save_in_field(result_field, no_conversions); save_in_field(result_field, no_conversions);
} }
bool check_partition_func_processor(byte *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
/* Item represents one placeholder ('?') of prepared statement */ /* Item represents one placeholder ('?') of prepared statement */
...@@ -1664,8 +1667,8 @@ class Item_static_float_func :public Item_float ...@@ -1664,8 +1667,8 @@ class Item_static_float_func :public Item_float
{} {}
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 *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
...@@ -1743,7 +1746,7 @@ class Item_string :public Item ...@@ -1743,7 +1746,7 @@ class Item_string :public Item
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -1758,8 +1761,8 @@ class Item_static_string_func :public Item_string ...@@ -1758,8 +1761,8 @@ class Item_static_string_func :public Item_string
{} {}
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 *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
...@@ -1772,8 +1775,8 @@ class Item_datetime :public Item_string ...@@ -1772,8 +1775,8 @@ class Item_datetime :public Item_string
&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 *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
class Item_empty_string :public Item_string class Item_empty_string :public Item_string
...@@ -1796,8 +1799,8 @@ class Item_return_int :public Item_int ...@@ -1796,8 +1799,8 @@ class Item_return_int :public Item_int
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 *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
...@@ -1821,7 +1824,7 @@ class Item_hex_string: public Item ...@@ -1821,7 +1824,7 @@ class Item_hex_string: public Item
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -2048,8 +2051,8 @@ class Item_int_with_ref :public Item_int ...@@ -2048,8 +2051,8 @@ class Item_int_with_ref :public Item_int
} }
Item *new_item(); Item *new_item();
virtual Item *real_item() { return ref; } virtual Item *real_item() { return ref; }
bool check_partition_func_processor(byte *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
......
...@@ -240,7 +240,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2 ...@@ -240,7 +240,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2
} }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
virtual Item *negated_item(); virtual Item *negated_item();
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
class Item_func_not :public Item_bool_func class Item_func_not :public Item_bool_func
...@@ -251,7 +251,7 @@ class Item_func_not :public Item_bool_func ...@@ -251,7 +251,7 @@ class Item_func_not :public Item_bool_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
class Item_maxmin_subselect; class Item_maxmin_subselect;
...@@ -468,7 +468,7 @@ class Item_func_between :public Item_func_opt_neg ...@@ -468,7 +468,7 @@ class Item_func_between :public Item_func_opt_neg
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -480,7 +480,7 @@ class Item_func_strcmp :public Item_bool_func2 ...@@ -480,7 +480,7 @@ class Item_func_strcmp :public Item_bool_func2
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -543,7 +543,7 @@ class Item_func_ifnull :public Item_func_coalesce ...@@ -543,7 +543,7 @@ class Item_func_ifnull :public Item_func_coalesce
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -584,7 +584,7 @@ class Item_func_nullif :public Item_bool_func2 ...@@ -584,7 +584,7 @@ class Item_func_nullif :public Item_bool_func2
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -627,7 +627,7 @@ class Item_func_case :public Item_func ...@@ -627,7 +627,7 @@ class Item_func_case :public Item_func
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 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -978,7 +978,7 @@ class Item_func_in :public Item_func_opt_neg ...@@ -978,7 +978,7 @@ class Item_func_in :public Item_func_opt_neg
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
/* Functions used by where clause */ /* Functions used by where clause */
...@@ -1020,7 +1020,7 @@ class Item_func_isnull :public Item_bool_func ...@@ -1020,7 +1020,7 @@ class Item_func_isnull :public Item_bool_func
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 *bool_arg) { return 0;} 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 */
...@@ -1042,8 +1042,8 @@ class Item_is_not_null_test :public Item_func_isnull ...@@ -1042,8 +1042,8 @@ class Item_is_not_null_test :public Item_func_isnull
*/ */
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 *bool_arg) bool check_partition_func_processor(byte *int_arg)
{ *(bool *)bool_arg= FALSE; return 0; } { *(int *)int_arg= 0; return FALSE; }
}; };
...@@ -1066,7 +1066,7 @@ class Item_func_isnotnull :public Item_bool_func ...@@ -1066,7 +1066,7 @@ class Item_func_isnotnull :public Item_bool_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -1105,7 +1105,7 @@ class Item_func_like :public Item_bool_func2 ...@@ -1105,7 +1105,7 @@ class Item_func_like :public Item_bool_func2
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
#ifdef USE_REGEX #ifdef USE_REGEX
...@@ -1128,7 +1128,7 @@ class Item_func_regex :public Item_bool_func ...@@ -1128,7 +1128,7 @@ class Item_func_regex :public Item_bool_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
#else #else
...@@ -1185,7 +1185,7 @@ class Item_cond :public Item_bool_func ...@@ -1185,7 +1185,7 @@ class Item_cond :public Item_bool_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ class Item_func_md5 :public Item_str_func ...@@ -47,7 +47,7 @@ class Item_func_md5 :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -58,7 +58,6 @@ class Item_func_sha :public Item_str_func ...@@ -58,7 +58,6 @@ class Item_func_sha :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "sha"; } const char *func_name() const { return "sha"; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_aes_encrypt :public Item_str_func class Item_func_aes_encrypt :public Item_str_func
...@@ -89,7 +88,7 @@ class Item_func_concat :public Item_str_func ...@@ -89,7 +88,7 @@ class Item_func_concat :public Item_str_func
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 *bool_arg) { return 0;} 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
...@@ -111,7 +110,7 @@ class Item_func_reverse :public Item_str_func ...@@ -111,7 +110,7 @@ class Item_func_reverse :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -149,7 +148,7 @@ class Item_str_conv :public Item_str_func ...@@ -149,7 +148,7 @@ class Item_str_conv :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -213,7 +212,6 @@ class Item_func_substr :public Item_str_func ...@@ -213,7 +212,6 @@ class Item_func_substr :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "substr"; } const char *func_name() const { return "substr"; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -225,7 +223,6 @@ class Item_func_substr_index :public Item_str_func ...@@ -225,7 +223,6 @@ class Item_func_substr_index :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "substring_index"; } const char *func_name() const { return "substring_index"; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -242,7 +239,6 @@ class Item_func_trim :public Item_str_func ...@@ -242,7 +239,6 @@ class Item_func_trim :public Item_str_func
const char *func_name() const { return "trim"; } const char *func_name() const { return "trim"; }
void print(String *str); void print(String *str);
virtual const char *mode_name() const { return "both"; } virtual const char *mode_name() const { return "both"; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -443,7 +439,7 @@ class Item_func_soundex :public Item_str_func ...@@ -443,7 +439,7 @@ class Item_func_soundex :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -551,7 +547,7 @@ class Item_func_rpad :public Item_str_func ...@@ -551,7 +547,7 @@ class Item_func_rpad :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -564,7 +560,7 @@ class Item_func_lpad :public Item_str_func ...@@ -564,7 +560,7 @@ class Item_func_lpad :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -579,7 +575,7 @@ class Item_func_conv :public Item_str_func ...@@ -579,7 +575,7 @@ class Item_func_conv :public Item_str_func
collation.set(default_charset()); collation.set(default_charset());
max_length= 64; max_length= 64;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -596,7 +592,7 @@ class Item_func_hex :public Item_str_func ...@@ -596,7 +592,7 @@ class Item_func_hex :public Item_str_func
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 *bool_arg) { return 0;} 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
...@@ -612,7 +608,7 @@ class Item_func_unhex :public Item_str_func ...@@ -612,7 +608,7 @@ class Item_func_unhex :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -636,7 +632,7 @@ class Item_func_binary :public Item_str_func ...@@ -636,7 +632,7 @@ class Item_func_binary :public Item_str_func
} }
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
...@@ -676,7 +672,7 @@ class Item_func_inet_ntoa : public Item_str_func ...@@ -676,7 +672,7 @@ class Item_func_inet_ntoa : public Item_str_func
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 *bool_arg) { return 0;} 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
...@@ -691,7 +687,7 @@ class Item_func_quote :public Item_str_func ...@@ -691,7 +687,7 @@ class Item_func_quote :public Item_str_func
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 *bool_arg) { return 0;} 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
...@@ -735,7 +731,6 @@ class Item_func_conv_charset :public Item_str_func ...@@ -735,7 +731,6 @@ class Item_func_conv_charset :public Item_str_func
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "convert"; } const char *func_name() const { return "convert"; }
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_set_collation :public Item_str_func class Item_func_set_collation :public Item_str_func
...@@ -768,7 +763,6 @@ class Item_func_charset :public Item_str_func ...@@ -768,7 +763,6 @@ class Item_func_charset :public Item_str_func
maybe_null= 0; maybe_null= 0;
}; };
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_collation :public Item_str_func class Item_func_collation :public Item_str_func
...@@ -784,7 +778,6 @@ class Item_func_collation :public Item_str_func ...@@ -784,7 +778,6 @@ class Item_func_collation :public Item_str_func
maybe_null= 0; maybe_null= 0;
}; };
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_crc32 :public Item_int_func class Item_func_crc32 :public Item_int_func
...@@ -795,7 +788,7 @@ class Item_func_crc32 :public Item_int_func ...@@ -795,7 +788,7 @@ class Item_func_crc32 :public Item_int_func
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 *bool_arg) { return 0;} 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
...@@ -806,7 +799,6 @@ class Item_func_uncompressed_length : public Item_int_func ...@@ -806,7 +799,6 @@ class Item_func_uncompressed_length : public Item_int_func
const char *func_name() const{return "uncompressed_length";} const char *func_name() const{return "uncompressed_length";}
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 *bool_arg) { return 0;}
}; };
#ifdef HAVE_COMPRESS #ifdef HAVE_COMPRESS
...@@ -823,7 +815,6 @@ class Item_func_compress: public Item_str_func ...@@ -823,7 +815,6 @@ class Item_func_compress: public Item_str_func
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;} void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
const char *func_name() const{return "compress";} const char *func_name() const{return "compress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION String *val_str(String *) ZLIB_DEPENDED_FUNCTION
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_uncompress: public Item_str_func class Item_func_uncompress: public Item_str_func
...@@ -834,7 +825,6 @@ class Item_func_uncompress: public Item_str_func ...@@ -834,7 +825,6 @@ class Item_func_uncompress: public Item_str_func
void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;} void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
const char *func_name() const{return "uncompress";} const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION String *val_str(String *) ZLIB_DEPENDED_FUNCTION
bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
#define UUID_LENGTH (8+1+4+1+4+1+4+1+12) #define UUID_LENGTH (8+1+4+1+4+1+4+1+12)
......
...@@ -39,7 +39,7 @@ class Item_func_period_add :public Item_int_func ...@@ -39,7 +39,7 @@ class Item_func_period_add :public Item_int_func
{ {
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -54,7 +54,7 @@ class Item_func_period_diff :public Item_int_func ...@@ -54,7 +54,7 @@ class Item_func_period_diff :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -71,7 +71,7 @@ class Item_func_to_days :public Item_int_func ...@@ -71,7 +71,7 @@ class Item_func_to_days :public Item_int_func
maybe_null=1; maybe_null=1;
} }
enum_monotonicity_info get_monotonicity_info() const; enum_monotonicity_info get_monotonicity_info() const;
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -87,7 +87,7 @@ class Item_func_dayofmonth :public Item_int_func ...@@ -87,7 +87,7 @@ class Item_func_dayofmonth :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -112,7 +112,7 @@ class Item_func_month :public Item_func ...@@ -112,7 +112,7 @@ class Item_func_month :public Item_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -145,7 +145,7 @@ class Item_func_dayofyear :public Item_int_func ...@@ -145,7 +145,7 @@ class Item_func_dayofyear :public Item_int_func
max_length=3*MY_CHARSET_BIN_MB_MAXLEN; max_length=3*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -161,7 +161,7 @@ class Item_func_hour :public Item_int_func ...@@ -161,7 +161,7 @@ class Item_func_hour :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -177,7 +177,7 @@ class Item_func_minute :public Item_int_func ...@@ -177,7 +177,7 @@ class Item_func_minute :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -193,7 +193,7 @@ class Item_func_quarter :public Item_int_func ...@@ -193,7 +193,7 @@ class Item_func_quarter :public Item_int_func
max_length=1*MY_CHARSET_BIN_MB_MAXLEN; max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -209,7 +209,7 @@ class Item_func_second :public Item_int_func ...@@ -209,7 +209,7 @@ class Item_func_second :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -225,7 +225,7 @@ class Item_func_week :public Item_int_func ...@@ -225,7 +225,7 @@ class Item_func_week :public Item_int_func
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 *bool_arg) { return 0;} 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
...@@ -240,7 +240,7 @@ class Item_func_yearweek :public Item_int_func ...@@ -240,7 +240,7 @@ class Item_func_yearweek :public Item_int_func
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -257,7 +257,7 @@ class Item_func_year :public Item_int_func ...@@ -257,7 +257,7 @@ class Item_func_year :public Item_int_func
max_length=4*MY_CHARSET_BIN_MB_MAXLEN; max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -287,7 +287,7 @@ class Item_func_weekday :public Item_func ...@@ -287,7 +287,7 @@ class Item_func_weekday :public Item_func
max_length=1*MY_CHARSET_BIN_MB_MAXLEN; max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
class Item_func_dayname :public Item_func_weekday class Item_func_dayname :public Item_func_weekday
...@@ -320,7 +320,7 @@ class Item_func_unix_timestamp :public Item_int_func ...@@ -320,7 +320,7 @@ class Item_func_unix_timestamp :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -335,7 +335,7 @@ class Item_func_time_to_sec :public Item_int_func ...@@ -335,7 +335,7 @@ class Item_func_time_to_sec :public Item_int_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -545,7 +545,7 @@ class Item_func_from_days :public Item_date ...@@ -545,7 +545,7 @@ class Item_func_from_days :public Item_date
Item_func_from_days(Item *a) :Item_date(a) {} Item_func_from_days(Item *a) :Item_date(a) {}
const char *func_name() const { return "from_days"; } const char *func_name() const { return "from_days"; }
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -563,7 +563,7 @@ class Item_func_date_format :public Item_str_func ...@@ -563,7 +563,7 @@ class Item_func_date_format :public Item_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -582,7 +582,7 @@ class Item_func_from_unixtime :public Item_date_func ...@@ -582,7 +582,7 @@ 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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -651,7 +651,7 @@ class Item_func_sec_to_time :public Item_str_func ...@@ -651,7 +651,7 @@ class Item_func_sec_to_time :public Item_str_func
return tmp_table_field_from_field_type(table, 0); return tmp_table_field_from_field_type(table, 0);
} }
bool result_as_longlong() { return TRUE; } bool result_as_longlong() { return TRUE; }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -674,7 +674,7 @@ class Item_date_add_interval :public Item_date_func ...@@ -674,7 +674,7 @@ class Item_date_add_interval :public Item_date_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -692,7 +692,7 @@ class Item_extract :public Item_int_func ...@@ -692,7 +692,7 @@ class Item_extract :public Item_int_func
void fix_length_and_dec(); void fix_length_and_dec();
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -729,7 +729,7 @@ class Item_typecast_maybe_null :public Item_typecast ...@@ -729,7 +729,7 @@ class Item_typecast_maybe_null :public Item_typecast
max_length=args[0]->max_length; max_length=args[0]->max_length;
maybe_null= 1; maybe_null= 1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -749,7 +749,7 @@ class Item_char_typecast :public Item_typecast ...@@ -749,7 +749,7 @@ class Item_char_typecast :public Item_typecast
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -829,7 +829,7 @@ class Item_func_makedate :public Item_str_func ...@@ -829,7 +829,7 @@ class Item_func_makedate :public Item_str_func
} }
bool result_as_longlong() { return TRUE; } bool result_as_longlong() { return TRUE; }
longlong val_int(); longlong val_int();
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -852,7 +852,7 @@ class Item_func_add_time :public Item_str_func ...@@ -852,7 +852,7 @@ class Item_func_add_time :public Item_str_func
} }
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
class Item_func_timediff :public Item_str_func class Item_func_timediff :public Item_str_func
...@@ -892,7 +892,7 @@ class Item_func_maketime :public Item_str_func ...@@ -892,7 +892,7 @@ class Item_func_maketime :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 0); return tmp_table_field_from_field_type(table, 0);
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} 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
...@@ -906,7 +906,7 @@ class Item_func_microsecond :public Item_int_func ...@@ -906,7 +906,7 @@ class Item_func_microsecond :public Item_int_func
decimals=0; decimals=0;
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -924,7 +924,7 @@ class Item_func_timestamp_diff :public Item_int_func ...@@ -924,7 +924,7 @@ class Item_func_timestamp_diff :public Item_int_func
maybe_null=1; maybe_null=1;
} }
void print(String *str); void print(String *str);
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
...@@ -971,7 +971,7 @@ class Item_func_str_to_date :public Item_str_func ...@@ -971,7 +971,7 @@ class Item_func_str_to_date :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 1); return tmp_table_field_from_field_type(table, 1);
} }
bool check_partition_func_processor(byte *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE;}
}; };
......
...@@ -42,7 +42,7 @@ class Item_func_xml_extractvalue: public Item_xml_str_func ...@@ -42,7 +42,7 @@ class Item_func_xml_extractvalue: public Item_xml_str_func
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 *bool_arg) { return 0;} bool check_partition_func_processor(byte *int_arg) { return FALSE; }
}; };
......
...@@ -695,6 +695,7 @@ bool partition_info::check_list_constants() ...@@ -695,6 +695,7 @@ bool partition_info::check_list_constants()
file A reference to a handler of the table file A reference to a handler of the table
info Create info info Create info
engine_type Return value for used engine in partitions engine_type Return value for used engine in partitions
check_partition_function Should we check the partition function
RETURN VALUE RETURN VALUE
TRUE Error, something went wrong TRUE Error, something went wrong
...@@ -709,27 +710,42 @@ bool partition_info::check_list_constants() ...@@ -709,27 +710,42 @@ bool partition_info::check_list_constants()
*/ */
bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
handler *file, HA_CREATE_INFO *info) handler *file, HA_CREATE_INFO *info,
bool check_partition_function)
{ {
handlerton **engine_array= NULL; handlerton **engine_array= NULL;
uint part_count= 0; uint part_count= 0;
uint i, tot_partitions; uint i, tot_partitions;
bool result= TRUE; bool result= TRUE;
char *same_name; char *same_name;
bool part_expression_ok= TRUE;
DBUG_ENTER("partition_info::check_partition_info"); DBUG_ENTER("partition_info::check_partition_info");
if (check_partition_function)
{
int part_expression_ok= 1;
int pf_collation_allowed= 1;
int spf_collation_allowed= 1;
if (part_type != HASH_PARTITION || !list_of_part_fields) if (part_type != HASH_PARTITION || !list_of_part_fields)
{
part_expr->walk(&Item::check_partition_func_processor, 0, part_expr->walk(&Item::check_partition_func_processor, 0,
(byte*)(&part_expression_ok)); (byte*)(&part_expression_ok));
pf_collation_allowed= part_expression_ok;
part_expression_ok= 1;
if (is_sub_partitioned() && !list_of_subpart_fields) if (is_sub_partitioned() && !list_of_subpart_fields)
{
subpart_expr->walk(&Item::check_partition_func_processor, 0, subpart_expr->walk(&Item::check_partition_func_processor, 0,
(byte*)(&part_expression_ok)); (byte*)(&part_expression_ok));
if (!part_expression_ok) }
spf_collation_allowed= part_expression_ok;
}
if (!pf_collation_allowed ||
!spf_collation_allowed)
{ {
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0)); my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
goto end; goto end;
} }
}
if (unlikely(!is_sub_partitioned() && if (unlikely(!is_sub_partitioned() &&
!(use_default_subpartitions && use_default_no_subpartitions))) !(use_default_subpartitions && use_default_no_subpartitions)))
{ {
......
...@@ -61,6 +61,16 @@ class partition_info : public Sql_alloc ...@@ -61,6 +61,16 @@ class partition_info : public Sql_alloc
*/ */
get_subpart_id_func get_subpartition_id; get_subpart_id_func get_subpartition_id;
/*
When we have various string fields we might need some preparation
before and clean-up after calling the get_part_id_func's. We need
one such method for get_partition_id and one for
get_part_partition_id and one for get_subpartition_id.
*/
get_part_id_func get_partition_id_charset;
get_part_id_func get_part_partition_id_charset;
get_subpart_id_func get_subpartition_id_charset;
/* NULL-terminated array of fields used in partitioned expression */ /* NULL-terminated array of fields used in partitioned expression */
Field **part_field_array; Field **part_field_array;
/* NULL-terminated array of fields used in subpartitioned expression */ /* NULL-terminated array of fields used in subpartitioned expression */
...@@ -72,6 +82,16 @@ class partition_info : public Sql_alloc ...@@ -72,6 +82,16 @@ class partition_info : public Sql_alloc
*/ */
Field **full_part_field_array; Field **full_part_field_array;
/*
When we have a field that requires transformation before calling the
partition functions we must allocate field buffers for the field of
the fields in the partition function.
*/
char **part_field_buffers;
char **subpart_field_buffers;
char **restore_part_field_ptrs;
char **restore_subpart_field_ptrs;
Item *part_expr; Item *part_expr;
Item *subpart_expr; Item *subpart_expr;
...@@ -188,6 +208,8 @@ class partition_info : public Sql_alloc ...@@ -188,6 +208,8 @@ class partition_info : public Sql_alloc
bool is_auto_partitioned; bool is_auto_partitioned;
bool from_openfrm; bool from_openfrm;
bool has_null_value; bool has_null_value;
bool includes_charset_field_part;
bool includes_charset_field_subpart;
partition_info() partition_info()
...@@ -195,6 +217,8 @@ class partition_info : public Sql_alloc ...@@ -195,6 +217,8 @@ class partition_info : public Sql_alloc
get_subpartition_id(NULL), get_subpartition_id(NULL),
part_field_array(NULL), subpart_field_array(NULL), part_field_array(NULL), subpart_field_array(NULL),
full_part_field_array(NULL), full_part_field_array(NULL),
part_field_buffers(NULL), subpart_field_buffers(NULL),
restore_part_field_ptrs(NULL), restore_subpart_field_ptrs(NULL),
part_expr(NULL), subpart_expr(NULL), item_free_list(NULL), part_expr(NULL), subpart_expr(NULL), item_free_list(NULL),
first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL), first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL),
list_array(NULL), list_array(NULL),
...@@ -217,7 +241,8 @@ class partition_info : public Sql_alloc ...@@ -217,7 +241,8 @@ class partition_info : public Sql_alloc
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE), list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
linear_hash_ind(FALSE), fixed(FALSE), linear_hash_ind(FALSE), fixed(FALSE),
is_auto_partitioned(FALSE), from_openfrm(FALSE), is_auto_partitioned(FALSE), from_openfrm(FALSE),
has_null_value(FALSE) has_null_value(FALSE), includes_charset_field_part(FALSE),
includes_charset_field_subpart(FALSE)
{ {
all_fields_in_PF.clear_all(); all_fields_in_PF.clear_all();
all_fields_in_PPF.clear_all(); all_fields_in_PPF.clear_all();
...@@ -250,7 +275,8 @@ class partition_info : public Sql_alloc ...@@ -250,7 +275,8 @@ class partition_info : public Sql_alloc
bool check_range_constants(); bool check_range_constants();
bool check_list_constants(); bool check_list_constants();
bool check_partition_info(THD *thd, handlerton **eng_type, bool check_partition_info(THD *thd, handlerton **eng_type,
handler *file, HA_CREATE_INFO *info); handler *file, HA_CREATE_INFO *info,
bool check_partition_function);
void print_no_partition_found(TABLE *table); void print_no_partition_found(TABLE *table);
private: private:
static int list_part_cmp(const void* a, const void* b); static int list_part_cmp(const void* a, const void* b);
......
This diff is collapsed.
...@@ -3183,7 +3183,8 @@ bool mysql_create_table_internal(THD *thd, ...@@ -3183,7 +3183,8 @@ bool mysql_create_table_internal(THD *thd,
} }
DBUG_PRINT("info", ("db_type = %d", DBUG_PRINT("info", ("db_type = %d",
ha_legacy_type(part_info->default_engine_type))); ha_legacy_type(part_info->default_engine_type)));
if (part_info->check_partition_info(thd, &engine_type, file, create_info)) if (part_info->check_partition_info(thd, &engine_type, file,
create_info, TRUE))
goto err; goto err;
part_info->default_engine_type= engine_type; part_info->default_engine_type= engine_type;
......
...@@ -3637,6 +3637,7 @@ part_bit_expr: ...@@ -3637,6 +3637,7 @@ part_bit_expr:
{ {
Item *part_expr= $1; Item *part_expr= $1;
bool not_corr_func; bool not_corr_func;
int part_expression_ok= 1;
LEX *lex= Lex; LEX *lex= Lex;
THD *thd= YYTHD; THD *thd= YYTHD;
longlong item_value; longlong item_value;
...@@ -3654,13 +3655,19 @@ part_bit_expr: ...@@ -3654,13 +3655,19 @@ part_bit_expr:
mem_alloc_error(sizeof(part_elem_value)); mem_alloc_error(sizeof(part_elem_value));
YYABORT; YYABORT;
} }
part_expr->walk(&Item::check_partition_func_processor, 0,
(byte*)(&part_expression_ok));
if (!part_expression_ok)
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
YYABORT;
}
if (part_expr->fix_fields(YYTHD, (Item**)0) || if (part_expr->fix_fields(YYTHD, (Item**)0) ||
((context->table_list= save_list), FALSE) || ((context->table_list= save_list), FALSE) ||
(!part_expr->const_item()) || (!part_expr->const_item()) ||
(!lex->safe_to_cache_query)) (!lex->safe_to_cache_query))
{ {
yyerror(ER(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR)); my_error(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR, MYF(0));
YYABORT; YYABORT;
} }
thd->where= save_where; thd->where= save_where;
......
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