MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:September 22 2007 7:35am
Subject:bk commit into 5.0 tree (evgen:1.2424) BUG#27990
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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-09-22 11:35:11+04:00, evgen@stripped +3 -0
  Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
  
  The change_to_use_tmp_fields function leaves the orig_table member of an
  expression's tmp table field filled for the new Item_field being created.
  Later orig_table is used by the Field::make_field function to provide some
  info about original table and field name to a user. This is ok for a field
  but for an expression it should be empty.
  
  The change_to_use_tmp_fields function now resets orig_table member of
  an expression's tmp table field to prevent providing a wrong info to a user.
  The Field::make_field function now resets the table_name and the org_col_name
  variables when the orig_table is set to 0.

  sql/field.cc@stripped, 2007-09-22 11:33:42+04:00, evgen@stripped +13 -3
    Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
    The Field::make_field function now resets the table_name and the org_col_name
    variables when the orig_table is set to 0.

  sql/sql_select.cc@stripped, 2007-09-22 11:34:24+04:00, evgen@stripped +2 -0
    Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
    The change_to_use_tmp_fields function now resets orig_table member of
    an expression's tmp table field to prevent providing a wrong info to a user.

  tests/mysql_client_test.c@stripped, 2007-09-22 11:34:35+04:00, evgen@stripped +25 -18
    The test case for the bug#21635 is altered to test behavior on both const and
    non-const tables.

# 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:	evgen
# Host:	sunlight.local
# Root:	/local_work/27990-bug-5.0-opt-mysql

--- 1.344/sql/field.cc	2007-03-19 23:59:19 +03:00
+++ 1.345/sql/field.cc	2007-09-22 11:33:42 +04:00
@@ -1282,15 +1282,25 @@
 
 void Field::make_field(Send_field *field)
 {
-  if (orig_table->s->table_cache_key && *(orig_table->s->table_cache_key))
+  if (orig_table && orig_table->s->table_cache_key &&
+      *(orig_table->s->table_cache_key))
   {
     field->org_table_name= orig_table->s->table_name;
     field->db_name= orig_table->s->table_cache_key;
   }
   else
     field->org_table_name= field->db_name= "";
-  field->table_name= orig_table->alias;
-  field->col_name= field->org_col_name= field_name;
+  if (orig_table)
+  {
+    field->table_name= orig_table->alias;
+    field->org_col_name= field_name;
+  }
+  else
+  {
+    field->table_name= "";
+    field->org_col_name= "";
+  }
+  field->col_name= field_name;
   field->charsetnr= charset()->number;
   field->length=field_length;
   field->type=type();

--- 1.505/sql/sql_select.cc	2007-03-29 20:20:31 +04:00
+++ 1.506/sql/sql_select.cc	2007-09-22 11:34:24 +04:00
@@ -14119,6 +14119,8 @@
 	  item_field= (Item*) new Item_field(field);
 	if (!item_field)
 	  DBUG_RETURN(TRUE);                    // Fatal error
+
+        field->orig_table= 0;
 	item_field->name= item->name;
 #ifndef DBUG_OFF
 	if (_db_on_ && !item_field->name)

--- 1.223/tests/mysql_client_test.c	2007-01-22 15:10:43 +03:00
+++ 1.224/tests/mysql_client_test.c	2007-09-22 11:34:35 +04:00
@@ -15502,28 +15502,35 @@
   myquery(rc);
   rc= mysql_query(mysql, "CREATE TABLE t1 (i INT)");
   myquery(rc);
-  rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
-  myquery(rc);
+  /*
+    We need this loop to ensure correct behavior with both constant and
+    non-constant tables.
+  */
+  for (j= 0; j < 2 ; j++)
+  {
+    rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
+    myquery(rc);
 
-  rc= mysql_real_query(mysql, query, query_end - query);
-  myquery(rc);
+    rc= mysql_real_query(mysql, query, query_end - query);
+    myquery(rc);
 
-  result= mysql_use_result(mysql);
-  DIE_UNLESS(result);
+    result= mysql_use_result(mysql);
+    DIE_UNLESS(result);
 
-  field_count= mysql_field_count(mysql);
-  for (i= 0; i < field_count; ++i)
-  {
-    field= mysql_fetch_field_direct(result, i);
-    printf("%s -> %s ... ", expr[i * 2], field->name);
-    fflush(stdout);
-    DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 &&
-               field->table[0] == 0 && field->org_name[0] == 0);
-    DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0);
-    puts("OK");
-  }
+    field_count= mysql_field_count(mysql);
+    for (i= 0; i < field_count; ++i)
+    {
+      field= mysql_fetch_field_direct(result, i);
+      printf("%s -> %s ... ", expr[i * 2], field->name);
+      fflush(stdout);
+      DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 &&
+                 field->table[0] == 0 && field->org_name[0] == 0);
+      DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0);
+      puts("OK");
+    }
 
-  mysql_free_result(result);
+    mysql_free_result(result);
+  }
   rc= mysql_query(mysql, "DROP TABLE t1");
   myquery(rc);
 
Thread
bk commit into 5.0 tree (evgen:1.2424) BUG#27990eugene22 Sep