Commit 451cffcf authored by unknown's avatar unknown
Browse files

Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1

into  c-8b0ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.1

parents 134b8536 b6f97cb4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -290,7 +290,8 @@ partition by range (a)
partitions 2
(partition x1 values less than (4.0) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
ERROR HY000: VALUES LESS THAN value must be of same type as partition function
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
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -530,7 +531,8 @@ partition by list (a)
partitions 2
(partition x1 values in (4.0, 12+8),
partition x2 values in (3, 21));
ERROR HY000: VALUES IN value must be of same type as partition function
ERROR 42000: VALUES value must be of same type as partition function near ' 12+8),
partition x2 values in (3, 21))' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
+2 −2
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ partitions 2
#
# Partition by range, inconsistent partition function and constants
#
--error 1450
--error 1064
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -702,7 +702,7 @@ partitions 2
#
# Partition by list, wrong constant result type (not INT)
#
--error 1450
--error 1064
CREATE TABLE t1 (
a int not null,
b int not null,
+4 −4
Original line number Diff line number Diff line
@@ -402,12 +402,12 @@ class Item;
class partition_element :public Sql_alloc {
public:
  List<partition_element> subpartitions;
  List<Item> list_expr_list;
  List<longlong> list_val_list;
  ulonglong part_max_rows;
  ulonglong part_min_rows;
  char *partition_name;
  char *tablespace_name;
  Item* range_expr;
  longlong range_value;
  char* part_comment;
  char* data_file_name;
  char* index_file_name;
@@ -416,12 +416,12 @@ class partition_element :public Sql_alloc {
  
  partition_element()
  : part_max_rows(0), part_min_rows(0), partition_name(NULL),
    tablespace_name(NULL), range_expr(NULL), part_comment(NULL),
    tablespace_name(NULL), range_value(0), part_comment(NULL),
    data_file_name(NULL), index_file_name(NULL),
    engine_type(DB_TYPE_UNKNOWN), nodegroup_id(UNDEF_NODEGROUP)
  {
    subpartitions.empty();
    list_expr_list.empty();
    list_val_list.empty();
  }
  ~partition_element() {}
};
+2 −2
Original line number Diff line number Diff line
@@ -5427,8 +5427,8 @@ ER_RANGE_NOT_INCREASING_ERROR
        eng "VALUES LESS THAN value must be strictly increasing for each partition"
        swe "Vrden i VALUES LESS THAN mste vara strikt vxande fr varje partition"
ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
        eng "VALUES %s value must be of same type as partition function"
        swe "Vrden i VALUES %s mste vara av samma typ som partitioneringsfunktionen"
        eng "VALUES value must be of same type as partition function"
        swe "Vrden i VALUES mste vara av samma typ som partitioneringsfunktionen"
ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
        eng "Multiple definition of same constant in list partitioning"
        swe "Multipel definition av samma konstant i list partitionering"
+14 −32
Original line number Diff line number Diff line
@@ -250,16 +250,7 @@ static bool check_range_constants(partition_info *part_info)
  {
    part_def= it++;
    if ((i != (no_parts - 1)) || !part_info->defined_max_value)
    {
      if (likely(part_def->range_expr->result_type() == INT_RESULT))
        part_range_value_int= part_def->range_expr->val_int(); 
      else
      {
        my_error(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR, MYF(0),
                 "LESS THAN");
        goto end;
      }
    }
      part_range_value_int= part_def->range_value; 
    else
      part_range_value_int= LONGLONG_MAX;
    if (likely(current_largest_int < part_range_value_int))
@@ -327,7 +318,7 @@ static int list_part_cmp(const void* a, const void* b)
static bool check_list_constants(partition_info *part_info)
{
  uint i, no_list_values= 0, no_parts, list_index= 0;
  Item *list_expr;
  longlong *list_value;
  bool not_first, result= TRUE;
  longlong curr_value, prev_value;
  partition_element* part_def;
@@ -342,8 +333,7 @@ static bool check_list_constants(partition_info *part_info)

    We use this number to allocate a properly sized array of structs
    to keep the partition id and the value to use in that partition.
    In the second traversal we check that all Item trees are of the
    same type (INT_RESULT) and assign them values in the struct array.
    In the second traversal we assign them values in the struct array.

    Finally we sort the array of structs in order of values to enable
    a quick binary search for the proper value to discover the
@@ -357,7 +347,7 @@ static bool check_list_constants(partition_info *part_info)
  do
  {
    part_def= list_func_it++;
    List_iterator<Item> list_val_it1(part_def->list_expr_list);
    List_iterator<longlong> list_val_it1(part_def->list_val_list);
    while (list_val_it1++)
      no_list_values++;
  } while (++i < no_parts);
@@ -375,20 +365,12 @@ static bool check_list_constants(partition_info *part_info)
  do
  {
    part_def= list_func_it++;
    List_iterator<Item> list_val_it2(part_def->list_expr_list);
    while ((list_expr= list_val_it2++))
    List_iterator<longlong> list_val_it2(part_def->list_val_list);
    while ((list_value= list_val_it2++))
    {
      if (likely(list_expr->result_type() == INT_RESULT))
      {
        part_info->list_array[list_index].list_value= list_expr->val_int();
      part_info->list_array[list_index].list_value= *list_value;
      part_info->list_array[list_index++].partition_id= i;
    }
      else
      {
        my_error(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR, MYF(0), "IN");
        goto end;
      }
    }
  } while (++i < no_parts);

  qsort((void*)part_info->list_array, no_list_values,
@@ -1820,10 +1802,10 @@ static int add_partition_values(File fptr, partition_info *part_info,
  if (part_info->part_type == RANGE_PARTITION)
  {
    err+= add_string(fptr, "VALUES LESS THAN ");
    if (p_elem->range_expr)
    if (p_elem->range_value != LONGLONG_MAX)
    {
      err+= add_begin_parenthesis(fptr);
      err+= add_int(fptr,p_elem->range_expr->val_int());
      err+= add_int(fptr, p_elem->range_value);
      err+= add_end_parenthesis(fptr);
    }
    else
@@ -1832,15 +1814,15 @@ static int add_partition_values(File fptr, partition_info *part_info,
  else if (part_info->part_type == LIST_PARTITION)
  {
    uint i;
    List_iterator<Item> list_expr_it(p_elem->list_expr_list);
    List_iterator<longlong> list_val_it(p_elem->list_val_list);
    err+= add_string(fptr, "VALUES IN ");
    uint no_items= p_elem->list_expr_list.elements;
    uint no_items= p_elem->list_val_list.elements;
    err+= add_begin_parenthesis(fptr);
    i= 0;
    do
    {
      Item *list_expr= list_expr_it++;
      err+= add_int(fptr, list_expr->val_int());
      longlong *list_value= list_val_it++;
      err+= add_int(fptr, *list_value);
      if (i != (no_items-1))
        err+= add_comma(fptr);
    } while (++i < no_items);
Loading