Commit 503aa33e authored by unknown's avatar unknown
Browse files

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

into  dator5.(none):/home/pappa/bug18198


mysql-test/r/partition.result:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.h:
  Auto merged
sql/partition_info.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 3e2dfa97 670b6573
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -756,7 +756,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a)  */
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 by list (cast(s1 as signed))
(partition p1 values in (1),
partition p2 values in (2));
drop table t1;
+17 −0
Original line number Diff line number Diff line
drop table if exists t1;
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
partition by key (a);
Warnings:
+1 −1
Original line number Diff line number Diff line
@@ -891,7 +891,7 @@ drop table t2;
# Bug#14367: Partitions: crash if utf8 column
#
create table t1 (s1 char(2) character set utf8)
partition by list (case when s1 > 'cz' then 1 else 2 end)
partition by list (cast(s1 as signed))
(partition p1 values in (1),
 partition p2 values in (2));
drop table t1;
+22 −0
Original line number Diff line number Diff line
@@ -8,6 +8,28 @@
drop table if exists t1;
--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
#
+25 −21
Original line number Diff line number Diff line
@@ -789,7 +789,7 @@ class Item {
    Check if a partition function is allowed
    SYNOPSIS
      check_partition_func_processor()
      bool_arg                        Return argument
      int_arg                        Return argument
    RETURN VALUE
      0
    DESCRIPTION
@@ -806,8 +806,12 @@ class Item {
    whether this should be inherited to the new class. If not the function
    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 *set_no_const_sub(byte *arg) { return this; }
@@ -1099,7 +1103,7 @@ class Item_name_const : public Item
    Item::maybe_null= TRUE;
  }

  bool check_partition_func_processor(byte *bool_arg) { return 0; }
  bool check_partition_func_processor(byte *int_arg) { return FALSE; }
  bool fix_fields(THD *, Item **);

  enum Type type() const;
@@ -1145,7 +1149,7 @@ class Item_num: public Item
  Item_num() {}                               /* Remove gcc warning */
  virtual Item_num *neg()= 0;
  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))
@@ -1303,7 +1307,7 @@ class Item_field :public Item_ident
  bool collect_item_field_processor(byte * arg);
  bool find_item_in_field_list_processor(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();
  bool result_as_longlong()
  {
@@ -1351,7 +1355,7 @@ class Item_null :public Item
  bool is_null() { return 1; }
  void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
  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
@@ -1364,8 +1368,8 @@ class Item_null_result :public Item_null
  {
    save_in_field(result_field, no_conversions);
  }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};  

/* Item represents one placeholder ('?') of prepared statement */
@@ -1656,8 +1660,8 @@ class Item_static_float_func :public Item_float
  {}
  void print(String *str) { str->append(func_name); }
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};


@@ -1735,7 +1739,7 @@ class Item_string :public Item
  void print(String *str);
  // to prevent drop fixed flag (no need parent cleanup call)
  void cleanup() {}
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return FALSE;}
};


@@ -1750,8 +1754,8 @@ class Item_static_string_func :public Item_string
  {}
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  void print(String *str) { str->append(func_name); }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};


@@ -1764,8 +1768,8 @@ class Item_datetime :public Item_string
                                                    &my_charset_bin)
  { max_length=19;}
  enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};

class Item_empty_string :public Item_string
@@ -1788,8 +1792,8 @@ class Item_return_int :public Item_int
    unsigned_flag=1;
  }
  enum_field_types field_type() const { return int_field_type; }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};


@@ -1813,7 +1817,7 @@ class Item_hex_string: public Item
  void cleanup() {}
  bool eq(const Item *item, bool binary_cmp) const;
  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; }
};


@@ -2040,8 +2044,8 @@ class Item_int_with_ref :public Item_int
  }
  Item *new_item();
  virtual Item *real_item() { return ref; }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
};

#ifdef MYSQL_SERVER
Loading