summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2010-03-09 16:03:54 +0100
committerunknown <knielsen@knielsen-hq.org>2010-03-09 16:03:54 +0100
commitc9dffa993a845752a847c4fe36c99cc6adbc35a8 (patch)
tree5fa3fbbdfccf7e04807fcada9aaa36c2e9f6ae59
parent4bf849c23c2fe2174016da630705a362f76d3922 (diff)
downloadmariadb-git-c9dffa993a845752a847c4fe36c99cc6adbc35a8.tar.gz
A number of after-merge fixes following merge of MySQL 5.1.44 into MariaDB.
Bug#46949: memory leak with failed alter table to create partitions based on extract() Bug#51830: Incorrect partition pruning on range partition (regression) Fixed valgrind failure in select_describe(), read of uninitialized Item_subselect::eliminated. PBXT test file updates to reflect changes done in MySQL. mysql-test/suite/pbxt/r/partition_error.result: Result file update following MySQL 5.1.44 changes. mysql-test/suite/pbxt/r/partition_pruning.result: Result file update following MySQL 5.1.44 changes. mysql-test/suite/pbxt/t/partition_error.test: Test file update following MySQL 5.1.44 changes. sql/item_subselect.cc: Fixed valgrind failure in select_describe(), read of uninitialized Item_subselect::eliminated: - it turns out we can call select_describe() without having fixed subquery items for child subselects. These are not the kind of subqueries that we could eliminate, so the fix is to ensure that item_subselect->eliminated==FALSE even before fix_fields is called. Also added code to reset item_subselect->eliminated back to FALSE in Item::reset() call. sql/item_subselect.h: Fixed valgrind failure in select_describe(), read of uninitialized Item_subselect::eliminated: - it turns out we can call select_describe() without having fixed subquery items for child subselects. These are not the kind of subqueries that we could eliminate, so the fix is to ensure that item_subselect->eliminated==FALSE even before fix_fields is called. Also added code to reset item_subselect->eliminated back to FALSE in Item::reset() call. sql/sql_partition.cc: Fix Bug#51830: Revert part of the patch for Bug#49742, which caused the regression. sql/table.cc: Fix Bug#46949: memory leak in failed ALTER TABLE with partitioning.
-rw-r--r--mysql-test/suite/pbxt/r/partition_error.result18
-rw-r--r--mysql-test/suite/pbxt/r/partition_pruning.result2
-rw-r--r--mysql-test/suite/pbxt/t/partition_error.test4
-rw-r--r--sql/item_subselect.cc4
-rw-r--r--sql/item_subselect.h3
-rw-r--r--sql/sql_partition.cc5
-rw-r--r--sql/table.cc2
7 files changed, 22 insertions, 16 deletions
diff --git a/mysql-test/suite/pbxt/r/partition_error.result b/mysql-test/suite/pbxt/r/partition_error.result
index af708fb01b0..a36d0bddabb 100644
--- a/mysql-test/suite/pbxt/r/partition_error.result
+++ b/mysql-test/suite/pbxt/r/partition_error.result
@@ -107,7 +107,7 @@ primary key(a,b))
partition by hash (rand(a))
partitions 2
(partition x1, partition x2);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1, partition x2)' at line 6
CREATE TABLE t1 (
@@ -118,7 +118,7 @@ primary key(a,b))
partition by range (rand(a))
partitions 2
(partition x1 values less than (0), partition x2 values less than (2));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1 values less than (0), partition x2 values less than' at line 6
CREATE TABLE t1 (
@@ -129,7 +129,7 @@ primary key(a,b))
partition by list (rand(a))
partitions 2
(partition x1 values in (1), partition x2 values in (2));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
(partition x1 values in (1), partition x2 values in (2))' at line 6
CREATE TABLE t1 (
@@ -244,7 +244,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (rand(a+b));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 7
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -341,7 +341,7 @@ partition by range (3+4)
partitions 2
(partition x1 values less than (4) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
-ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -511,7 +511,7 @@ partition by list (3+4)
partitions 2
(partition x1 values in (4) tablespace ts1,
partition x2 values in (8) tablespace ts2);
-ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -603,13 +603,13 @@ partition by range (ascii(v))
ERROR HY000: This partition function is not allowed
create table t1 (a int)
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 or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash(CURTIME() + a);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash (NOW()+a);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
create table t1 (a int)
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
ERROR HY000: This partition function is not allowed
diff --git a/mysql-test/suite/pbxt/r/partition_pruning.result b/mysql-test/suite/pbxt/r/partition_pruning.result
index 9938d352ff7..2f43fa6eb86 100644
--- a/mysql-test/suite/pbxt/r/partition_pruning.result
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result
@@ -527,7 +527,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where
explain partitions select * from t2 where (a > 100 AND a < 600);
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 910 Using where
+1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 910 Using where
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
diff --git a/mysql-test/suite/pbxt/t/partition_error.test b/mysql-test/suite/pbxt/t/partition_error.test
index 622b4f483b4..5b0c90b9a20 100644
--- a/mysql-test/suite/pbxt/t/partition_error.test
+++ b/mysql-test/suite/pbxt/t/partition_error.test
@@ -421,7 +421,7 @@ partitions 2
#
# Partition by range, constant partition function not allowed
#
---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -636,7 +636,7 @@ partition by list (a);
#
# Partition by list, constant partition function not allowed
#
---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 6292a93dd20..aa69bb47949 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -39,7 +39,8 @@ inline Item * and_items(Item* cond, Item *item)
Item_subselect::Item_subselect():
Item_result_field(), value_assigned(0), thd(0), substitution(0),
engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(0),
- const_item_cache(1), in_fix_fields(0), engine_changed(0), changed(0), is_correlated(FALSE)
+ const_item_cache(1), in_fix_fields(0), eliminated(FALSE),
+ engine_changed(0), changed(0), is_correlated(FALSE)
{
with_subselect= 1;
reset();
@@ -431,6 +432,7 @@ void Item_maxmin_subselect::print(String *str, enum_query_type query_type)
void Item_singlerow_subselect::reset()
{
+ eliminated= FALSE;
null_value= 1;
if (value)
value->null_value= 1;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 50f8885f862..8d43f2bd383 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -90,6 +90,7 @@ public:
void cleanup();
virtual void reset()
{
+ eliminated= FALSE;
null_value= 1;
}
virtual trans_res select_transformer(JOIN *join);
@@ -235,6 +236,7 @@ public:
subs_type substype() { return EXISTS_SUBS; }
void reset()
{
+ eliminated= FALSE;
value= 0;
}
@@ -306,6 +308,7 @@ public:
subs_type substype() { return IN_SUBS; }
void reset()
{
+ eliminated= FALSE;
value= 0;
null_value= 0;
was_null= 0;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index c5c5191d176..143073a67b5 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -3019,8 +3019,9 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
In case of PARTITION p VALUES LESS THAN MAXVALUE
the maximum value is in the current partition.
*/
- if (part_func_value == part_end_val &&
- (loc_part_id < max_partition || !part_info->defined_max_value))
+ if (part_func_value > part_end_val ||
+ (part_func_value == part_end_val &&
+ (loc_part_id < max_partition || !part_info->defined_max_value)))
loc_part_id++;
}
else
diff --git a/sql/table.cc b/sql/table.cc
index 088a22b5203..d3fc85f2be8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1847,8 +1847,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
{
if (work_part_info_used)
tmp= fix_partition_func(thd, outparam, is_create_table);
- outparam->part_info->item_free_list= part_func_arena.free_list;
}
+ outparam->part_info->item_free_list= part_func_arena.free_list;
partititon_err:
if (tmp)
{