Commit bbd922b0 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Removed column_list and fixed all issues relating to this change

parent aaa79d95
......@@ -405,14 +405,12 @@ create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
ERROR 42000: VALUES value must be of same type as partition function near '),
partition p1 values less than (10))' at line 3
ERROR HY000: VALUES value must be of same type as partition function
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
partition p1 values in (10));
ERROR 42000: VALUES value must be of same type as partition function near '),
partition p1 values in (10))' at line 3
ERROR HY000: VALUES value must be of same type as partition function
create table t1 (a bigint unsigned)
partition by range (a)
(partition p0 values less than (100),
......@@ -1407,7 +1405,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
(PARTITION p0 VALUES LESS THAN (NULL));
ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '))' at line 3
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
create table t1 (s1 int auto_increment primary key)
partition by list (s1)
(partition p1 values in (1),
......
This diff is collapsed.
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
create table t1 (a char, b char, c char)
partition by range column_list(a,b,c)
( partition p0 values less than (column_list('a','b','c')));
( partition p0 values less than ('a','b','c'));
insert into t1 values ('a', NULL, 'd');
explain partitions select * from t1 where a = 'a' AND c = 'd';
id select_type table partitions type possible_keys key key_len ref rows Extra
......@@ -11,13 +11,13 @@ a b c
a NULL d
drop table t1;
create table t1 (a int not null) partition by range column_list(a) (
partition p0 values less than (column_list(10)),
partition p1 values less than (column_list(20)),
partition p2 values less than (column_list(30)),
partition p3 values less than (column_list(40)),
partition p4 values less than (column_list(50)),
partition p5 values less than (column_list(60)),
partition p6 values less than (column_list(70))
partition p0 values less than (10),
partition p1 values less than (20),
partition p2 values less than (30),
partition p3 values less than (40),
partition p4 values less than (50),
partition p5 values less than (60),
partition p6 values less than (70)
);
insert into t1 values (5),(15),(25),(35),(45),(55),(65);
insert into t1 values (5),(15),(25),(35),(45),(55),(65);
......@@ -41,15 +41,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
drop table t1, t2;
create table t1 (a int not null, b int not null )
partition by range column_list(a,b) (
partition p01 values less than (column_list(2,10)),
partition p02 values less than (column_list(2,20)),
partition p03 values less than (column_list(2,30)),
partition p11 values less than (column_list(4,10)),
partition p12 values less than (column_list(4,20)),
partition p13 values less than (column_list(4,30)),
partition p21 values less than (column_list(6,10)),
partition p22 values less than (column_list(6,20)),
partition p23 values less than (column_list(6,30))
partition p01 values less than (2,10),
partition p02 values less than (2,20),
partition p03 values less than (2,30),
partition p11 values less than (4,10),
partition p12 values less than (4,20),
partition p13 values less than (4,30),
partition p21 values less than (6,10),
partition p22 values less than (6,20),
partition p23 values less than (6,30)
);
insert into t1 values (2,5), (2,15), (2,25),
(4,5), (4,15), (4,25), (6,5), (6,15), (6,25);
......
......@@ -361,8 +361,7 @@ partition by range (a)
partitions 2
(partition x1 values less than (4.0) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
ERROR 42000: VALUES value must be of same type as partition function near ') tablespace ts1,
partition x2 values less than (8) tablespace ts2)' at line 8
ERROR HY000: VALUES value must be of same type as partition function
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -412,8 +411,7 @@ partition by list (a)
partitions 2
(partition x1 values less than 4,
partition x2 values less than (5));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
partition x2 values less than (5))' at line 8
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -423,7 +421,7 @@ partition by range (a)
partitions 2
(partition x1 values less than maxvalue,
partition x2 values less than (5));
ERROR 42000: MAXVALUE can only be used in last partition definition near '))' at line 9
ERROR HY000: MAXVALUE can only be used in last partition definition
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -433,7 +431,7 @@ partition by range (a)
partitions 2
(partition x1 values less than maxvalue,
partition x2 values less than maxvalue);
ERROR 42000: MAXVALUE can only be used in last partition definition near 'maxvalue)' at line 9
ERROR HY000: MAXVALUE can only be used in last partition definition
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -602,8 +600,7 @@ partition by list (a)
partitions 2
(partition x1 values in (4.0, 12+8),
partition x2 values in (3, 21));
ERROR 42000: VALUES value must be of same type as partition function near ' 12+8),
partition x2 values in (3, 21))' at line 8
ERROR HY000: VALUES value must be of same type as partition function
CREATE TABLE t1 (
a int not null,
b int not null,
......
......@@ -24,8 +24,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 1619 <DATA DIRECTORY> option ignored
Warning 1619 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
......@@ -3,8 +3,7 @@ create table t1 (a int)
partition by range (a)
( partition p0 values less than (NULL),
partition p1 values less than (MAXVALUE));
ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '),
partition p1 values less than (MAXVALUE))' at line 3
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
create table t1 (a datetime not null)
partition by range (TO_SECONDS(a))
( partition p0 VALUES LESS THAN (TO_SECONDS('2007-03-08 00:00:00')),
......
......@@ -101,8 +101,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 1619 <DATA DIRECTORY> option ignored
Warning 1619 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
......@@ -13,4 +13,3 @@ kill : Bug#37780 2008-12-03 HHunger need some changes to be
innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
init_connect : Bug#44920 2009-07-06 pcrews MTR not processing master.opt input properly on Windows. *Must be done this way due to the nature of the bug*
......@@ -339,12 +339,12 @@ drop table t1;
#
# BUG 16002: Handle unsigned integer functions properly
#
--error ER_PARSE_ERROR
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
--error ER_PARSE_ERROR
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
......@@ -1377,7 +1377,7 @@ PARTITION BY LIST (a)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_PARSE_ERROR
--error ER_NULL_IN_VALUES_LESS_THAN
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
(PARTITION p0 VALUES LESS THAN (NULL));
......
......@@ -9,7 +9,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
create table t1 (a char, b char, c char)
partition by range column_list(a,b,c)
( partition p0 values less than (column_list('a','b','c')));
( partition p0 values less than ('a','b','c'));
insert into t1 values ('a', NULL, 'd');
explain partitions select * from t1 where a = 'a' AND c = 'd';
select * from t1 where a = 'a' AND c = 'd';
......@@ -17,13 +17,13 @@ drop table t1;
## COLUMN_LIST partition pruning tests
create table t1 (a int not null) partition by range column_list(a) (
partition p0 values less than (column_list(10)),
partition p1 values less than (column_list(20)),
partition p2 values less than (column_list(30)),
partition p3 values less than (column_list(40)),
partition p4 values less than (column_list(50)),
partition p5 values less than (column_list(60)),
partition p6 values less than (column_list(70))
partition p0 values less than (10),
partition p1 values less than (20),
partition p2 values less than (30),
partition p3 values less than (40),
partition p4 values less than (50),
partition p5 values less than (60),
partition p6 values less than (70)
);
insert into t1 values (5),(15),(25),(35),(45),(55),(65);
insert into t1 values (5),(15),(25),(35),(45),(55),(65);
......@@ -47,17 +47,17 @@ drop table t1, t2;
create table t1 (a int not null, b int not null )
partition by range column_list(a,b) (
partition p01 values less than (column_list(2,10)),
partition p02 values less than (column_list(2,20)),
partition p03 values less than (column_list(2,30)),
partition p01 values less than (2,10),
partition p02 values less than (2,20),
partition p03 values less than (2,30),
partition p11 values less than (column_list(4,10)),
partition p12 values less than (column_list(4,20)),
partition p13 values less than (column_list(4,30)),
partition p11 values less than (4,10),
partition p12 values less than (4,20),
partition p13 values less than (4,30),
partition p21 values less than (column_list(6,10)),
partition p22 values less than (column_list(6,20)),
partition p23 values less than (column_list(6,30))
partition p21 values less than (6,10),
partition p22 values less than (6,20),
partition p23 values less than (6,30)
);
insert into t1 values (2,5), (2,15), (2,25),
......
......@@ -452,7 +452,7 @@ partitions 2
#
# Partition by range, inconsistent partition function and constants
#
--error 1064
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -522,7 +522,7 @@ partitions 2
#
# Partition by range, missing parenthesis
#
--error 1064
--error ER_PARTITION_WRONG_VALUES_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -536,7 +536,7 @@ partitions 2
#
# Partition by range, maxvalue in wrong place
#
--error 1064
--error ER_PARTITION_MAXVALUE_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -550,7 +550,7 @@ partitions 2
#
# Partition by range, maxvalue in several places
#
--error 1064
--error ER_PARTITION_MAXVALUE_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -765,7 +765,7 @@ partitions 2
#
# Partition by list, wrong constant result type (not INT)
#
--error 1064
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......
......@@ -9,7 +9,7 @@
drop table if exists t1, t2;
--enable_warnings
--error ER_PARSE_ERROR
--error ER_NULL_IN_VALUES_LESS_THAN
create table t1 (a int)
partition by range (a)
( partition p0 values less than (NULL),
......
This diff is collapsed.
......@@ -283,12 +283,14 @@ class partition_info : public Sql_alloc
void print_debug(const char *str, uint*);
int fix_func_partition(THD *thd,
part_elem_value *val,
partition_element *part_elem);
partition_element *part_elem,
uint part_id);
bool fix_column_value_functions(THD *thd,
part_elem_value *val,
uint part_id);
int fix_parser_data(THD *thd);
int add_max_value();
void init_col_val(part_column_list_val *col_val, Item *item);
int reorganize_into_single_field_col_val();
part_column_list_val *add_column_value();
bool set_part_expr(char *start_token, Item *item_ptr,
......@@ -296,7 +298,7 @@ class partition_info : public Sql_alloc
static int compare_column_values(const void *a, const void *b);
bool set_up_charset_field_preps();
bool init_column_part();
bool add_column_list_value(Item *item);
bool add_column_list_value(THD *thd, Item *item);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
......
......@@ -2007,14 +2007,6 @@ static int add_column_list_values(File fptr, partition_info *part_info,
char buffer[MAX_STR_SIZE_PF];
String str(buffer, sizeof(buffer), &my_charset_bin);
Item *item_expr= col_val->item_expression;
if (!col_val->fixed &&
(item_expr->fix_fields(current_thd, (Item**)0) ||
(!item_expr->const_item())))
{
my_error(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR, MYF(0));
return 1;
}
col_val->fixed= 1;
if (item_expr->null_value)
err+= add_string(fptr, "NULL");
else
......@@ -4340,38 +4332,63 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
if ((alter_info->flags & ALTER_ADD_PARTITION) ||
(alter_info->flags & ALTER_REORGANIZE_PARTITION))
{
if ((tab_part_info->column_list &&
alt_part_info->num_columns != tab_part_info->num_columns) ||
(!tab_part_info->column_list && alt_part_info->num_columns))
if (thd->work_part_info->part_type != tab_part_info->part_type)
{
my_error(ER_PARTITION_COLUMN_LIST_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
if ((thd->work_part_info->part_type != tab_part_info->part_type) &&
(thd->work_part_info->part_type != NOT_A_PARTITION))
{
if (thd->work_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else if (thd->work_part_info->part_type == LIST_PARTITION)
{
DBUG_ASSERT(thd->work_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
else if (tab_part_info->part_type == RANGE_PARTITION)
if (thd->work_part_info->part_type == NOT_A_PARTITION)
{
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
if (tab_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), "RANGE");
DBUG_RETURN(TRUE);
}
else if (tab_part_info->part_type == LIST_PARTITION)
{
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), "LIST");
DBUG_RETURN(TRUE);
}
/*
Hash partitions can be altered without parser finds out about
that it is HASH partitioned. So no error here.
*/
}
else
{
DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"LIST", "IN");
if (thd->work_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else if (thd->work_part_info->part_type == LIST_PARTITION)
{
DBUG_ASSERT(thd->work_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
else if (tab_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else
{
DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
DBUG_RETURN(TRUE);
}
}
if ((tab_part_info->column_list &&
alt_part_info->num_columns != tab_part_info->num_columns) ||
(!tab_part_info->column_list &&
(tab_part_info->part_type == RANGE_PARTITION ||
tab_part_info->part_type == LIST_PARTITION) &&
alt_part_info->num_columns != 1U) ||
(!tab_part_info->column_list &&
tab_part_info->part_type == HASH_PARTITION &&
alt_part_info->num_columns != 0))
{
my_error(ER_PARTITION_COLUMN_LIST_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
alt_part_info->column_list= tab_part_info->column_list;
......
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -3870,6 +3870,7 @@ part_func:
partition_info *part_info= Lex->part_info;
if (part_info->set_part_expr($2+1, $3, $4, FALSE))
{ MYSQL_YYABORT; }
part_info->num_columns= 1;
part_info->column_list= FALSE;
}
;
......@@ -3972,7 +3973,21 @@ opt_num_subparts:
part_defs:
/* empty */
{}
{
partition_info *part_info= Lex->part_info;
if (part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
"RANGE");
MYSQL_YYABORT;
}
else if (part_info->part_type == LIST_PARTITION)
{
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
"LIST");
MYSQL_YYABORT;
}
}
| '(' part_def_list ')'
{
partition_info *part_info= Lex->part_info;
......@@ -4081,7 +4096,7 @@ opt_part_values:
if (part_info->part_type != LIST_PARTITION)
{
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
"LIST", "IN");
MYSQL_YYABORT;
}
}
......@@ -4099,6 +4114,7 @@ part_func_max:
if (part_info->num_columns &&
part_info->num_columns != 1U)
{
part_info->print_debug("Kilroy II", NULL);
my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
MYSQL_YYABORT;
}
......@@ -4121,6 +4137,7 @@ part_values_in:
{
LEX *lex= Lex;
partition_info *part_info= lex->part_info;
part_info->print_debug("part_values_in: part_value_item", NULL);
if (part_info->num_columns != 1U)
{
......@@ -4128,6 +4145,7 @@ part_values_in:
part_info->num_columns == 0 ||
part_info->num_columns > MAX_REF_PARTS)
{
part_info->print_debug("Kilroy III", NULL);
my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
MYSQL_YYABORT;
}
......@@ -4135,7 +4153,8 @@ part_values_in:
Reorganize the current large array into a list of small
arrays with one entry in each array. This can happen
in the first partition of an ALTER TABLE statement where
we ADD or REORGANIZE partitions.
we ADD or REORGANIZE partitions. Also can only happen
for LIST partitions.
*/
if (part_info->reorganize_into_single_field_col_val())
{
......@@ -4163,9 +4182,9 @@ part_value_item:
'('
{
partition_info *part_info= Lex->part_info;
part_info->print_debug("( part_value_item", NULL);
/* Initialisation code needed for each list of value expressions */
if (!(part_info->column_list &&
part_info->part_type == LIST_PARTITION &&
if (!(part_info->part_type == LIST_PARTITION &&
part_info->num_columns == 1U) &&
part_info->init_column_part())
{
......@@ -4177,7 +4196,7 @@ part_value_item:
{
LEX *lex= Lex;
partition_info *part_info= Lex->part_info;
part_info->print_debug(") part_value_item", NULL);
if (part_info->num_columns == 0)
part_info->num_columns= part_info->curr_list_object;
if (part_info->num_columns != part_info->curr_list_object)
......@@ -4189,6 +4208,7 @@ part_value_item:
ensures that we only report errors when we know we have an
error.
*/
part_info->print_debug("Kilroy I", NULL);
my_parse_error(ER(ER_PARTITION_COLUMN_LIST_ERROR));
MYSQL_YYABORT;
}
......@@ -4227,7 +4247,7 @@ part_value_expr_item:
my_error(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR, MYF(0));
MYSQL_YYABORT;
}
if (part_info->add_column_list_value(part_expr))
if (part_info->add_column_list_value(YYTHD, part_expr))
{
MYSQL_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