Commit c90669c4 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Fixed removal of column_list keyword for VALUES part, retained for PARTITION...

Fixed removal of column_list keyword for VALUES part, retained for PARTITION BY RANGE/LIST COLUMN_LIST, not entirely working yet
parent 576dd76a
......@@ -2,24 +2,24 @@ drop table if exists t1;
create table t1 (a varchar(5))
engine=memory
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
create table t1 (a varchar(5))
engine=myisam
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
create table t1 (a varchar(5))
engine=innodb
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
......
......@@ -78,12 +78,12 @@ partition by range column_list(a,b)
ERROR 42000: Inconsistency in usage of column lists for partitioning near '))' at line 3
create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (column_list(1,"b")));
ERROR HY000: Inconsistency in usage of column lists for partitioning
(partition p0 values less than (1,"b"));
ERROR HY000: Cannot have more than one value for this type of RANGE partitioning
create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (column_list(1,"b")));
ERROR HY000: Inconsistency in usage of column lists for partitioning
(partition p0 values less than (1,"b"));
ERROR HY000: Cannot have more than one value for this type of RANGE partitioning
create table t1 (a int, b char(20));
create global index inx on t1 (a,b)
partition by range (a)
......@@ -91,7 +91,7 @@ partition by range (a)
drop table t1;
create table t1 (a int, b char(20))
partition by range column_list(b)
(partition p0 values less than (column_list("b")));
(partition p0 values less than ("b"));
drop table t1;
create table t1 (a int)
partition by range (a)
......
This diff is collapsed.
......@@ -11,8 +11,8 @@ drop table if exists t1;
create table t1 (a varchar(5))
engine=memory
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
......@@ -20,8 +20,8 @@ drop table t1;
create table t1 (a varchar(5))
engine=myisam
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
......@@ -29,8 +29,8 @@ drop table t1;
create table t1 (a varchar(5))
engine=innodb
partition by range column_list(a)
( partition p0 values less than (column_list('m')),
partition p1 values less than (column_list('za')));
( partition p0 values less than ('m'),
partition p1 values less than ('za'));
insert into t1 values ('j');
update t1 set a = 'z' where (a >= 'j');
drop table t1;
......
......@@ -64,15 +64,15 @@ create table t1 (a int, b char(20))
partition by range column_list(a,b)
(partition p0 values less than (1));
--error ER_PARTITION_COLUMN_LIST_ERROR
--error ER_TOO_MANY_VALUES_ERROR
create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (column_list(1,"b")));
(partition p0 values less than (1,"b"));
--error ER_PARTITION_COLUMN_LIST_ERROR
--error ER_TOO_MANY_VALUES_ERROR
create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (column_list(1,"b")));
(partition p0 values less than (1,"b"));
create table t1 (a int, b char(20));
create global index inx on t1 (a,b)
......@@ -82,7 +82,7 @@ drop table t1;
create table t1 (a int, b char(20))
partition by range column_list(b)
(partition p0 values less than (column_list("b")));
(partition p0 values less than ("b"));
drop table t1;
#
......
......@@ -74,6 +74,7 @@ typedef struct p_column_list_val
typedef struct p_elem_val
{
longlong value;
uint added_items;
bool null_value;
bool unsigned_flag;
part_column_list_val *col_val_array;
......
This diff is collapsed.
......@@ -280,11 +280,23 @@ class partition_info : public Sql_alloc
handler *file, HA_CREATE_INFO *info,
bool check_partition_function);
void print_no_partition_found(TABLE *table);
void print_debug(const char *str, uint*);
int fix_func_partition(THD *thd,
part_elem_value *val,
partition_element *part_elem);
bool fix_column_value_functions(THD *thd,
part_elem_value *val,
uint part_id);
int fix_parser_data(THD *thd);
int add_max_value();
int reorganize_into_single_field_col_val();
part_column_list_val *add_column_value();
bool set_part_expr(char *start_token, Item *item_ptr,
char *end_token, bool is_subpart);
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);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
......@@ -294,9 +306,6 @@ class partition_info : public Sql_alloc
uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name);
bool has_unique_name(partition_element *element);
bool fix_column_value_functions(THD *thd,
part_column_list_val *col_val,
uint part_id);
};
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
......
......@@ -5822,8 +5822,6 @@ ER_SAME_NAME_PARTITION
eng "Duplicate partition name %-.192s"
ger "Doppelter Partitionsname: %-.192s"
swe "Duplicerat partitionsnamn %-.192s"
ER_SAME_NAME_PARTITION_FIELD
eng "Duplicate partition field name %-.192s"
ER_NO_BINLOG_ERROR
eng "It is not allowed to shut off binlog on this command"
ger "Es es nicht erlaubt, bei diesem Befehl binlog abzuschalten"
......@@ -6192,6 +6190,12 @@ ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR
eng "Too many fields in '%s'"
ER_MAXVALUE_IN_LIST_PARTITIONING_ERROR
eng "Cannot use MAXVALUE as value in List partitioning"
ER_TOO_MANY_VALUES_ERROR
eng "Cannot have more than one value for this type of %-.64s partitioning"
ER_SAME_NAME_PARTITION_FIELD
eng "Duplicate partition field name %-.192s"
ER_ROW_SINGLE_PARTITION_FIELD_ERROR
eng "Row expressions in VALUES IN only allowed for multi-field column partitioning"
# When updating these, please update EXPLAIN_FILENAME_MAX_EXTRA_LENGTH in
# mysql_priv.h with the new maximal additional length for explain_filename.
......
......@@ -1990,8 +1990,11 @@ static int add_column_list_values(File fptr, partition_info *part_info,
int err= 0;
uint i;
uint num_elements= part_info->part_field_list.elements;
err+= add_string(fptr, partition_keywords[PKW_COLUMNS].str);
err+= add_begin_parenthesis(fptr);
bool use_parenthesis= (part_info->part_type == LIST_PARTITION &&
part_info->num_columns > 1U);
if (use_parenthesis)
err+= add_begin_parenthesis(fptr);
for (i= 0; i < num_elements; i++)
{
part_column_list_val *col_val= &list_value->col_val_array[i];
......@@ -2032,7 +2035,8 @@ static int add_column_list_values(File fptr, partition_info *part_info,
if (i != (num_elements - 1))
err+= add_string(fptr, comma_str);
}
err+= add_end_parenthesis(fptr);
if (use_parenthesis)
err+= add_end_parenthesis(fptr);
return err;
}
......@@ -3894,10 +3898,12 @@ bool mysql_unpack_partition(THD *thd,
mem_alloc_error(sizeof(partition_info));
goto end;
}
lex.part_info->part_state= part_state;
lex.part_info->part_state_len= part_state_len;
part_info= lex.part_info;
part_info->part_state= part_state;
part_info->part_state_len= part_state_len;
DBUG_PRINT("info", ("Parse: %s", part_buf));
if (parse_sql(thd, & parser_state, NULL))
if (parse_sql(thd, & parser_state, NULL) ||
part_info->fix_parser_data(thd))
{
thd->free_items();
goto end;
......@@ -3918,7 +3924,6 @@ bool mysql_unpack_partition(THD *thd,
*/
DBUG_PRINT("info", ("Successful parse"));
part_info= lex.part_info;
DBUG_PRINT("info", ("default engine = %s, default_db_type = %s",
ha_resolve_storage_engine_name(part_info->default_engine_type),
ha_resolve_storage_engine_name(default_db_type)));
......@@ -4370,6 +4375,11 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
}
DBUG_RETURN(TRUE);
}
alt_part_info->column_list= tab_part_info->column_list;
if (alt_part_info->fix_parser_data(thd))
{
DBUG_RETURN(TRUE);
}
}
if (alter_info->flags & ALTER_ADD_PARTITION)
{
......@@ -5126,6 +5136,10 @@ the generated partition syntax in a correct manner.
{
DBUG_PRINT("info", ("partition changed"));
*partition_changed= TRUE;
if (thd->work_part_info->fix_parser_data(thd))
{
DBUG_RETURN(TRUE);
}
}
/*
Set up partition default_engine_type either from the create_info
......
This diff is collapsed.
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