MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:monty Date:November 1 2005 1:54pm
Subject:bk commit into 5.0 tree (monty:1.1962) BUG#14536
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of monty. When monty 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
  1.1962 05/11/01 15:54:30 monty@stripped +14 -0
  Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort
  Fix for bug #14536: SELECT @a,@a:=... fails with prepared statements

  sql/table.cc
    1.201 05/11/01 15:54:16 monty@stripped +3 -6
    Simple optimization of new code

  sql/sql_view.h
    1.10 05/11/01 15:54:16 monty@stripped +1 -1
    Remove usage of current_thd() in mysql_make_view()

  sql/sql_view.cc
    1.74 05/11/01 15:54:16 monty@stripped +20 -22
    Remove usage of current_thd() in mysql_make_view()
    Simple optimization of new code

  sql/sql_select.cc
    1.370 05/11/01 15:54:16 monty@stripped +8 -3
    Fix for bug #14536: SELECT @a,@a:=... fails with prepared statements

  sql/sql_lex.h
    1.206 05/11/01 15:54:16 monty@stripped +2 -2
    Remove usage of current_thd() in mysql_make_view()

  sql/sql_base.cc
    1.314 05/11/01 15:54:16 monty@stripped +10 -9
    Remove usage of current_thd() in mysql_make_view()

  sql/item_timefunc.h
    1.61 05/11/01 15:54:16 monty@stripped +1 -0
    timediff() can return NULL for not NULL arguments

  sql/item_func.cc
    1.266 05/11/01 15:54:16 monty@stripped +0 -1
    Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort)

  sql/item.cc
    1.196 05/11/01 15:54:16 monty@stripped +7 -5
    Simple optimization during review of new code

  mysql-test/t/user_var.test
    1.32 05/11/01 15:54:16 monty@stripped +4 -0
    More test with SELECT @a:=

  mysql-test/t/disabled.def
    1.11 05/11/01 15:54:16 monty@stripped +0 -1
    Enable user_var.test for

  mysql-test/r/user_var.result
    1.37 05/11/01 15:54:16 monty@stripped +11 -0
    More test with SELECT @a:=

  mysql-test/r/type_newdecimal.result
    1.34 05/11/01 15:54:16 monty@stripped +1 -1
    Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort)

  mysql-test/r/func_sapdb.result
    1.14 05/11/01 15:54:15 monty@stripped +2 -2
    Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort)

# 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:	monty
# Host:	narttu.mysql.fi
# Root:	/home/my/mysql-5.0

--- 1.195/sql/item.cc	2005-10-28 10:12:30 +03:00
+++ 1.196/sql/item.cc	2005-11-01 15:54:16 +02:00
@@ -5082,14 +5082,16 @@
 {
   DBUG_ASSERT(fixed == 0);
   /* We should only check that arg is in first table */
-  st_table_list *orig_next_table= context->last_name_resolution_table;
-  context->last_name_resolution_table= context->first_name_resolution_table;
-  if (!arg->fixed && arg->fix_fields(thd, &arg))
+  if (!arg->fixed)
   {
+    bool res;
+    st_table_list *orig_next_table= context->last_name_resolution_table;
+    context->last_name_resolution_table= context->first_name_resolution_table;
+    res= arg->fix_fields(thd, &arg);
     context->last_name_resolution_table= orig_next_table;
-    return TRUE;
+    if (res)
+      return TRUE;
   }
-  context->last_name_resolution_table= orig_next_table;
 
   if (arg->type() == REF_ITEM)
   {

--- 1.265/sql/item_func.cc	2005-10-28 20:17:33 +03:00
+++ 1.266/sql/item_func.cc	2005-11-01 15:54:16 +02:00
@@ -636,7 +636,6 @@
 {
   decimals= args[0]->decimals;
   max_length= args[0]->max_length;
-  maybe_null= 1;
 }
 
 

--- 1.60/sql/item_timefunc.h	2005-10-28 02:35:59 +03:00
+++ 1.61/sql/item_timefunc.h	2005-11-01 15:54:16 +02:00
@@ -845,6 +845,7 @@
   {
     decimals=0;
     max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+    maybe_null= 1;
   }
   Field *tmp_table_field(TABLE *t_arg)
   {

--- 1.313/sql/sql_base.cc	2005-10-28 00:24:03 +03:00
+++ 1.314/sql/sql_base.cc	2005-11-01 15:54:16 +02:00
@@ -37,11 +37,11 @@
 			     TABLE_LIST *table_list, MEM_ROOT *mem_root);
 static void free_cache_entry(TABLE *entry);
 static void mysql_rm_tmp_tables(void);
-static my_bool open_new_frm(const char *path, const char *alias,
-                            const char *db, const char *table_name,
-			    uint db_stat, uint prgflag,
-			    uint ha_open_flags, TABLE *outparam,
-			    TABLE_LIST *table_desc, MEM_ROOT *mem_root);
+static bool open_new_frm(THD *thd, const char *path, const char *alias,
+                         const char *db, const char *table_name,
+                         uint db_stat, uint prgflag,
+                         uint ha_open_flags, TABLE *outparam,
+                         TABLE_LIST *table_desc, MEM_ROOT *mem_root);
 
 extern "C" byte *table_cache_key(const byte *record,uint *length,
 				 my_bool not_used __attribute__((unused)))
@@ -1755,7 +1755,7 @@
 		      thd->open_options, entry)) &&
       (error != 5 ||
        (fn_format(path, path, 0, reg_ext, MY_UNPACK_FILENAME),
-        open_new_frm(path, alias, db, name,
+        open_new_frm(thd, path, alias, db, name,
                      (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
                              HA_GET_INDEX | HA_TRY_READ_ONLY),
                      READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
@@ -5260,6 +5260,7 @@
 
   SYNOPSIS
     open_new_frm()
+    THD		  thread handler
     path	  path to .frm
     alias	  alias for table
     db            database
@@ -5273,8 +5274,8 @@
     mem_root	  temporary MEM_ROOT for parsing
 */
 
-static my_bool
-open_new_frm(const char *path, const char *alias,
+static bool
+open_new_frm(THD *thd, const char *path, const char *alias,
              const char *db, const char *table_name,
              uint db_stat, uint prgflag,
 	     uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc,
@@ -5296,7 +5297,7 @@
         my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
         goto err;
       }
-      if (mysql_make_view(parser, table_desc))
+      if (mysql_make_view(thd, parser, table_desc))
         goto err;
     }
     else

--- 1.205/sql/sql_lex.h	2005-10-29 12:11:25 +03:00
+++ 1.206/sql/sql_lex.h	2005-11-01 15:54:16 +02:00
@@ -361,8 +361,8 @@
 
   friend class st_select_lex_unit;
   friend bool mysql_new_select(struct st_lex *lex, bool move_down);
-  friend my_bool mysql_make_view (File_parser *parser,
-				  TABLE_LIST *table);
+  friend bool mysql_make_view(THD *thd, File_parser *parser,
+                              TABLE_LIST *table);
 private:
   void fast_exclude();
 };

--- 1.369/sql/sql_select.cc	2005-10-29 01:07:36 +03:00
+++ 1.370/sql/sql_select.cc	2005-11-01 15:54:16 +02:00
@@ -1237,7 +1237,8 @@
 
   if (zero_result_cause)
   {
-    (void) return_zero_rows(this, result, select_lex->leaf_tables, *columns_list,
+    (void) return_zero_rows(this, result, select_lex->leaf_tables,
+                            *columns_list,
 			    send_row_on_empty_set(),
 			    select_options,
 			    zero_result_cause,
@@ -1671,7 +1672,8 @@
   {
     thd->proc_info="Sending data";
     DBUG_PRINT("info", ("%s", thd->proc_info));
-    result->send_fields(*columns_list,
+    result->send_fields((procedure ? curr_join->procedure_fields_list :
+                         *curr_fields_list),
                         Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
     error= do_select(curr_join, curr_fields_list, NULL, procedure);
     thd->limit_found_rows= curr_join->send_records;
@@ -9023,7 +9025,6 @@
   int rc= 0;
   enum_nested_loop_state error= NESTED_LOOP_OK;
   JOIN_TAB *join_tab;
-  List<Item> *columns_list= procedure? &join->procedure_fields_list : fields;
   DBUG_ENTER("do_select");
 
   join->procedure=procedure;
@@ -9057,7 +9058,11 @@
 	error= (*end_select)(join,join_tab,1);
     }
     else if (join->send_row_on_empty_set())
+    {
+      List<Item> *columns_list= (procedure ? &join->procedure_fields_list :
+                                 fields);
       rc= join->result->send_data(*columns_list);
+    }
   }
   else
   {

--- 1.200/sql/table.cc	2005-10-28 00:56:37 +03:00
+++ 1.201/sql/table.cc	2005-11-01 15:54:16 +02:00
@@ -2654,7 +2654,7 @@
   GRANT_INFO *grant;
   const char *db_name;
   const char *table_name;
-  Security_context *save_security_ctx= 0;
+  Security_context *save_security_ctx;
   Security_context *new_sctx= table_ref->security_ctx;
   bool res;
 
@@ -2673,14 +2673,11 @@
     table_name= table_ref->table->s->table_name;
   }
 
+  save_security_ctx= thd->security_ctx;
   if (new_sctx)
-  {
-    save_security_ctx= thd->security_ctx;
     thd->security_ctx= new_sctx;
-  }
   res= check_grant_column(thd, grant, db_name, table_name, name, length);
-  if (save_security_ctx)
-    thd->security_ctx= save_security_ctx;
+  thd->security_ctx= save_security_ctx;
   return res;
 }
 #endif

--- 1.73/sql/sql_view.cc	2005-10-28 00:56:37 +03:00
+++ 1.74/sql/sql_view.cc	2005-11-01 15:54:16 +02:00
@@ -728,20 +728,24 @@
 
   SYNOPSIS
     mysql_make_view()
-    parser		- parser object;
-    table		- TABLE_LIST structure for filling
+    thd			Thread handler
+    parser		parser object
+    table		TABLE_LIST structure for filling
 
   RETURN
     0 ok
     1 error
 */
 
-my_bool
-mysql_make_view(File_parser *parser, TABLE_LIST *table)
+bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
 {
-  THD *thd= current_thd;
+  SELECT_LEX *end, *view_select;
+  LEX *old_lex, *lex;
+  Query_arena *arena, backup;
+  int res;
+  bool result;
   DBUG_ENTER("mysql_make_view");
-  DBUG_PRINT("info", ("table=%p (%s)", table, table->table_name));
+  DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
 
   if (table->view)
   {
@@ -765,16 +769,12 @@
     DBUG_RETURN(0);
   }
 
-  SELECT_LEX *end;
-  LEX *old_lex= thd->lex, *lex;
-  SELECT_LEX *view_select;
-  int res= 0;
-
   /*
     For now we assume that tables will not be changed during PS life (it
     will be TRUE as far as we make new table cache).
   */
-  Query_arena *arena= thd->stmt_arena, backup;
+  old_lex= thd->lex;
+  arena= thd->stmt_arena;
   if (arena->is_conventional())
     arena= 0;
   else
@@ -1133,23 +1133,21 @@
     (st_select_lex_node**)&old_lex->all_selects_list;
 
 ok2:
-  if (arena)
-    thd->restore_active_arena(arena, &backup);
   if (!old_lex->time_zone_tables_used && thd->lex->time_zone_tables_used)
     old_lex->time_zone_tables_used= thd->lex->time_zone_tables_used;
-  thd->lex= old_lex;
-  if (!table->prelocking_placeholder && table->prepare_security(thd))
-    DBUG_RETURN(1);
-
-  DBUG_RETURN(0);
+  result= !table->prelocking_placeholder && table->prepare_security(thd);
 
-err:
+end:
   if (arena)
     thd->restore_active_arena(arena, &backup);
+  thd->lex= old_lex;
+  DBUG_RETURN(result);
+
+err:
   delete table->view;
   table->view= 0;	// now it is not VIEW placeholder
-  thd->lex= old_lex;
-  DBUG_RETURN(1);
+  result= 1;
+  goto end;
 }
 
 

--- 1.9/sql/sql_view.h	2005-09-16 18:13:15 +03:00
+++ 1.10/sql/sql_view.h	2005-11-01 15:54:16 +02:00
@@ -19,7 +19,7 @@
 bool mysql_create_view(THD *thd,
                        enum_view_create_mode mode);
 
-my_bool mysql_make_view(File_parser *parser, TABLE_LIST *table);
+bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table);
 
 bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
 

--- 1.13/mysql-test/r/func_sapdb.result	2005-04-18 14:58:53 +03:00
+++ 1.14/mysql-test/r/func_sapdb.result	2005-11-01 15:54:15 +02:00
@@ -180,8 +180,8 @@
 f1	date	NO		0000-00-00	
 f2	datetime	YES		NULL	
 f3	time	YES		NULL	
-f4	time	NO		00:00:00	
-f5	time	NO		00:00:00	
+f4	time	YES		NULL	
+f5	time	YES		NULL	
 f6	time	NO		00:00:00	
 f7	datetime	YES		NULL	
 f8	date	YES		NULL	

--- 1.33/mysql-test/r/type_newdecimal.result	2005-10-28 20:16:37 +03:00
+++ 1.34/mysql-test/r/type_newdecimal.result	2005-11-01 15:54:16 +02:00
@@ -176,7 +176,7 @@
 t1	CREATE TABLE `t1` (
   `round(15.4,-1)` decimal(3,0) unsigned NOT NULL default '0',
   `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
-  `abs(-1.1)` decimal(2,1) default NULL,
+  `abs(-1.1)` decimal(2,1) NOT NULL default '0.0',
   `-(-1.1)` decimal(2,1) NOT NULL default '0.0'
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;

--- 1.10/mysql-test/t/disabled.def	2005-11-01 14:14:13 +02:00
+++ 1.11/mysql-test/t/disabled.def	2005-11-01 15:54:16 +02:00
@@ -16,4 +16,3 @@
 rpl_deadlock    : Unstable test case, bug#12429
 kill            : Unstable test case, bug#9712
 archive_gis     : The test fails on 32bit Linux
-user_var        : Ramil should fix this soon

--- 1.36/mysql-test/r/user_var.result	2005-08-02 05:21:52 +03:00
+++ 1.37/mysql-test/r/user_var.result	2005-11-01 15:54:16 +02:00
@@ -123,6 +123,17 @@
 0	1	1	0
 1	3	2	0
 3	6	3	0
+set @a=0;
+select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
+@a	@a:="hello"	@a	@a:=3	@a	@a:="hello again"
+0	hello	0	3	0	hello again
+0	hello	0	3	0	hello again
+0	hello	0	3	0	hello again
+select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
+@a	@a:="hello"	@a	@a:=3	@a	@a:="hello again"
+hello again	hello	hello again	3	hello again	hello again
+hello again	hello	hello again	3	hello again	hello again
+hello again	hello	hello again	3	hello again	hello again
 drop table t1;
 set @a=_latin2'test';
 select charset(@a),collation(@a),coercibility(@a);

--- 1.31/mysql-test/t/user_var.test	2005-08-02 03:54:53 +03:00
+++ 1.32/mysql-test/t/user_var.test	2005-11-01 15:54:16 +02:00
@@ -70,6 +70,10 @@
 insert t1 values (1),(2),(2),(3),(3),(3);
 select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
 select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
+
+set @a=0;
+select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
+select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
 drop table t1;
 
 #
Thread
bk commit into 5.0 tree (monty:1.1962) BUG#14536monty1 Nov