List:Commits« Previous MessageNext Message »
From:igor Date:February 13 2007 10:35pm
Subject:bk commit into 5.0 tree (ibabaev:1.2412)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ibabaev. When ibabaev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-13 23:35:06+01:00, ibabaev@stripped +12 -0
  Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
  into  bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
  MERGE: 1.2377.4.28

  BitKeeper/etc/gone@stripped, 2007-02-13 23:25:00+01:00, ibabaev@stripped +0 -1
    auto-union
    MERGE: 1.106.1.1

  mysql-test/r/select.result@stripped, 2007-02-13 23:32:45+01:00, ibabaev@stripped +1 -0
    Manual merge
    MERGE: 1.145.1.3

  mysql-test/t/select.test@stripped, 2007-02-13 23:34:51+01:00, ibabaev@stripped +1 -0
    Manual merge
    MERGE: 1.119.1.3

  mysys/my_getopt.c@stripped, 2007-02-13 23:25:05+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.59.1.1

  sql/field.h@stripped, 2007-02-13 23:25:05+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.196.1.1

  sql/item.cc@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.252.1.1

  sql/item_cmpfunc.cc@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.231.1.2

  sql/item_cmpfunc.h@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.139.1.1

  sql/mysql_priv.h@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.432.1.2

  sql/sql_prepare.cc@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +1 -0
    Auto merged
    MERGE: 1.191.1.1

  sql/sql_select.cc@stripped, 2007-02-13 23:25:06+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.488.1.2

  sql/table.cc@stripped, 2007-02-13 23:25:07+01:00, ibabaev@stripped +0 -0
    Auto merged
    MERGE: 1.242.1.2

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ibabaev
# Host:	bk-internal.mysql.com
# Root:	/data0/bk/mysql-5.0-opt/RESYNC

--- 1.199/sql/field.h	2007-02-13 23:35:12 +01:00
+++ 1.200/sql/field.h	2007-02-13 23:35:12 +01:00
@@ -29,7 +29,7 @@
 class Send_field;
 class Protocol;
 struct st_cache_field;
-void field_conv(Field *to,Field *from);
+int field_conv(Field *to,Field *from);
 
 inline uint get_enum_pack_length(int elements)
 {
@@ -1252,7 +1252,7 @@
   uint max_packed_col_length(uint max_length);
   void free() { value.free(); }
   inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
-  friend void field_conv(Field *to,Field *from);
+  friend int field_conv(Field *to,Field *from);
   uint size_of() const { return sizeof(*this); }
   bool has_charset(void) const
   { return charset() == &my_charset_bin ? FALSE : TRUE; }

--- 1.232/sql/item_cmpfunc.cc	2007-02-13 23:35:12 +01:00
+++ 1.233/sql/item_cmpfunc.cc	2007-02-13 23:35:12 +01:00
@@ -1240,11 +1240,11 @@
     They are compared as integers, so for const item this time-consuming
     conversion can be done only once, not for every single comparison
   */
-  if (args[0]->type() == FIELD_ITEM &&
+  if (args[0]->real_item()->type() == FIELD_ITEM &&
       thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
       thd->lex->sql_command != SQLCOM_SHOW_CREATE)
   {
-    Field *field=((Item_field*) args[0])->field;
+    Field *field=((Item_field*) (args[0]->real_item()))->field;
     if (field->can_be_compared_as_longlong())
     {
       /*
@@ -4089,11 +4089,9 @@
 
 void Item_equal::fix_length_and_dec()
 {
-  Item *item= const_item ? const_item : get_first();
+  Item *item= get_first();
   eval_item= cmp_item::get_comparator(item->result_type(),
                                       item->collation.collation);
-  if (item->result_type() == STRING_RESULT)
-    eval_item->cmp_charset= cmp_collation.collation;
 }
 
 bool Item_equal::walk(Item_processor processor, byte *arg)

--- 1.140/sql/item_cmpfunc.h	2007-02-13 23:35:12 +01:00
+++ 1.141/sql/item_cmpfunc.h	2007-02-13 23:35:12 +01:00
@@ -1299,7 +1299,6 @@
   Item *const_item;        /* optional constant item equal to fields items */
   cmp_item *eval_item;
   bool cond_false;
-  DTCollation cmp_collation;
 public:
   inline Item_equal()
     : Item_bool_func(), const_item(0), eval_item(0), cond_false(0)

--- 1.434/sql/mysql_priv.h	2007-02-13 23:35:12 +01:00
+++ 1.435/sql/mysql_priv.h	2007-02-13 23:35:12 +01:00
@@ -708,6 +708,7 @@
 		      char* packet, uint packet_length);
 void log_slow_statement(THD *thd);
 bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
+bool compare_record(TABLE *table, query_id_t query_id);
 
 bool table_cache_init(void);
 void table_cache_free(void);
@@ -938,7 +939,8 @@
 int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
 int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
 int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-bool get_schema_tables_result(JOIN *join);
+bool get_schema_tables_result(JOIN *join,
+                              enum enum_schema_table_state executed_place);
 #define is_schema_db(X) \
   !my_strcasecmp(system_charset_info, information_schema_name.str, (X))
 

--- 1.489/sql/sql_select.cc	2007-02-13 23:35:12 +01:00
+++ 1.490/sql/sql_select.cc	2007-02-13 23:35:12 +01:00
@@ -1505,7 +1505,7 @@
 
   if ((curr_join->select_lex->options & OPTION_SCHEMA_TABLE) &&
       !thd->lex->describe &&
-      get_schema_tables_result(curr_join))
+      get_schema_tables_result(curr_join, PROCESSED_BY_JOIN_EXEC))
   {
     DBUG_VOID_RETURN;
   }
@@ -12374,7 +12374,7 @@
   /* Fill schema tables with data before filesort if it's necessary */
   if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
       !thd->lex->describe &&
-      get_schema_tables_result(join))
+      get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX))
     goto err;
 
   if (table->s->tmp_table)
@@ -12746,15 +12746,15 @@
 
   for (;order;order=order->next,pos++)
   {
-    pos->field=0; pos->item=0;
-    if (order->item[0]->type() == Item::FIELD_ITEM)
-      pos->field= ((Item_field*) (*order->item))->field;
-    else if (order->item[0]->type() == Item::SUM_FUNC_ITEM &&
-	     !order->item[0]->const_item())
-      pos->field= ((Item_sum*) order->item[0])->get_tmp_table_field();
-    else if (order->item[0]->type() == Item::COPY_STR_ITEM)
+    Item *item= order->item[0]->real_item();
+    pos->field= 0; pos->item= 0;
+    if (item->type() == Item::FIELD_ITEM)
+      pos->field= ((Item_field*) item)->field;
+    else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
+      pos->field= ((Item_sum*) item)->get_tmp_table_field();
+    else if (item->type() == Item::COPY_STR_ITEM)
     {						// Blob patch
-      pos->item= ((Item_copy_string*) (*order->item))->item;
+      pos->item= ((Item_copy_string*) item)->item;
     }
     else
       pos->item= *order->item;

--- 1.243/sql/table.cc	2007-02-13 23:35:12 +01:00
+++ 1.244/sql/table.cc	2007-02-13 23:35:12 +01:00
@@ -472,17 +472,6 @@
       {
         char *val= (char*) interval->type_names[count];
         interval->type_lengths[count]= strlen(val);
-        /*
-          Replace all ',' symbols with NAMES_SEP_CHAR.
-          See the comment in unireg.cc, pack_fields() function
-          for details.
-        */
-        for (uint cnt= 0 ; cnt < interval->type_lengths[count] ; cnt++)
-        {
-          char c= val[cnt];
-          if (c == ',')
-            val[cnt]= NAMES_SEP_CHAR;
-        }       
       }
       interval->type_lengths[count]= 0;
     }

--- 1.148/mysql-test/r/select.result	2007-02-13 23:35:12 +01:00
+++ 1.149/mysql-test/r/select.result	2007-02-13 23:35:12 +01:00
@@ -3728,6 +3728,34 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ref	idx1,idx2	idx2	4	const	1	Using where
 DROP TABLE t1;
+CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
+INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
+INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
+ANALYZE TABLE t2;
+Table	Op	Msg_type	Msg_text
+test.t2	analyze	status	OK
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	
+1	SIMPLE	t1	range	ts	ts	4	NULL	1	Using where
+Warnings:
+Warning	1292	Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+a	ts	a	dt1	dt2
+30	2006-01-03 23:00:00	30	2006-01-01 00:00:00	2999-12-31 00:00:00
+Warnings:
+Warning	1292	Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
+DROP TABLE t1,t2;
 create table t1 (a bigint unsigned);
 insert into t1 values
 (if(1, 9223372036854775808, 1)),
@@ -3758,3 +3786,4 @@
 i	c	co
 1111111111111111111	1111111111111111111	1111111111111111111
 End of 5.0 tests
+

--- 1.122/mysql-test/t/select.test	2007-02-13 23:35:12 +01:00
+++ 1.123/mysql-test/t/select.test	2007-02-13 23:35:12 +01:00
@@ -3207,6 +3207,29 @@
         (ID2_with_null=1 OR ID2_with_null=2);
 
 DROP TABLE t1;
+
+#
+# Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
+#
+CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
+INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
+ANALYZE TABLE t1;
+
+CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
+INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
+ANALYZE TABLE t2;
+
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+  AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+  AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+  AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+  AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+
+DROP TABLE t1,t2;
 #
 # Bug #22026: Warning when using IF statement and large unsigned bigint
 #
@@ -3231,3 +3254,4 @@
   coalesce(cast(1111111111111111111 as unsigned), 1) co;
 
 --echo End of 5.0 tests
+
Thread
bk commit into 5.0 tree (ibabaev:1.2412)igor13 Feb