List:Internals« Previous MessageNext Message »
From:ramil Date:December 1 2005 11:26am
Subject:bk commit into 5.0 tree (ramil:1.2029) BUG#14304
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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.2029 05/12/01 14:26:46 ramil@stripped +5 -0
  Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).

  sql/sql_class.h
    1.277 05/12/01 14:26:28 ramil@stripped +1 -1
    Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).
    - clear_next_insert_id added

  sql/sql_class.cc
    1.225 05/12/01 14:26:28 ramil@stripped +2 -0
    Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).
    - save/restore clear_next_insert_id

  sql/sp_head.cc
    1.196 05/12/01 14:26:28 ramil@stripped +1 -1
    Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).
    - call thd->cleanup_after_query() to clean next_insert_id.

  mysql-test/t/sp.test
    1.165 05/12/01 14:26:28 ramil@stripped +31 -0
    Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).

  mysql-test/r/sp.result
    1.172 05/12/01 14:26:27 ramil@stripped +24 -0
    Fix for bug #14304: auto_increment field incorrect set from within stored procedure
(insert select).

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/mysql-5.0

--- 1.224/sql/sql_class.cc	2005-11-24 22:13:06 +04:00
+++ 1.225/sql/sql_class.cc	2005-12-01 14:26:28 +04:00
@@ -1948,6 +1948,7 @@ void THD::reset_sub_statement_state(Sub_
   backup->last_insert_id=  last_insert_id;
   backup->next_insert_id=  next_insert_id;
   backup->insert_id_used=  insert_id_used;
+  backup->clear_next_insert_id= clear_next_insert_id;
   backup->limit_found_rows= limit_found_rows;
   backup->examined_row_count= examined_row_count;
   backup->sent_row_count=   sent_row_count;
@@ -1999,6 +2000,7 @@ void THD::restore_sub_statement_state(Su
   last_insert_id=   backup->last_insert_id;
   next_insert_id=   backup->next_insert_id;
   insert_id_used=   backup->insert_id_used;
+  clear_next_insert_id= backup->clear_next_insert_id;
   limit_found_rows= backup->limit_found_rows;
   sent_row_count=   backup->sent_row_count;
   client_capabilities= backup->client_capabilities;

--- 1.276/sql/sql_class.h	2005-11-24 13:42:39 +04:00
+++ 1.277/sql/sql_class.h	2005-12-01 14:26:28 +04:00
@@ -1090,7 +1090,7 @@ public:
   ha_rows    cuted_fields, sent_row_count, examined_row_count;
   ulong client_capabilities;
   uint in_sub_stmt;
-  bool enable_slow_log, insert_id_used;
+  bool enable_slow_log, insert_id_used, clear_next_insert_id;
   my_bool no_send_ok;
   SAVEPOINT *savepoints;
 };

--- 1.171/mysql-test/r/sp.result	2005-11-28 16:20:08 +04:00
+++ 1.172/mysql-test/r/sp.result	2005-12-01 14:26:27 +04:00
@@ -4046,4 +4046,28 @@ boo
 2
 drop procedure bug14643_1|
 drop procedure bug14643_2|
+drop procedure if exists bug14304|
+drop table if exists t3, t4|
+create table t3(a int primary key auto_increment)|
+create table t4(a int primary key auto_increment)|
+create procedure bug14304()
+begin
+insert into t3 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 select null as a;
+insert into t3 set a=null;
+insert into t3 set a=null;
+select * from t3;
+end|
+call bug14304()|
+a
+1
+2
+3
+drop procedure bug14304|
+drop table t3, t4|
 drop table t1,t2;

--- 1.164/mysql-test/t/sp.test	2005-11-28 16:20:08 +04:00
+++ 1.165/mysql-test/t/sp.test	2005-12-01 14:26:28 +04:00
@@ -4823,6 +4823,37 @@ call bug14643_2()|
 drop procedure bug14643_1|
 drop procedure bug14643_2|
 
+#
+# BUG#14304: auto_increment field incorrect set in SP
+#
+--disable_warnings
+drop procedure if exists bug14304|
+drop table if exists t3, t4|
+--enable_warnings
+
+create table t3(a int primary key auto_increment)|
+create table t4(a int primary key auto_increment)|
+
+create procedure bug14304()
+begin
+  insert into t3 set a=null;
+  insert into t4 set a=null;
+  insert into t4 set a=null;
+  insert into t4 set a=null;
+  insert into t4 set a=null;
+  insert into t4 set a=null;
+  insert into t4 select null as a;
+  
+  insert into t3 set a=null;
+  insert into t3 set a=null;
+  
+  select * from t3;
+end|
+
+call bug14304()|
+
+drop procedure bug14304|
+drop table t3, t4|
 
 #
 # BUG#NNNN: New bug synopsis

--- 1.195/sql/sp_head.cc	2005-11-28 15:39:46 +04:00
+++ 1.196/sql/sp_head.cc	2005-12-01 14:26:28 +04:00
@@ -1069,7 +1069,7 @@ int sp_head::execute(THD *thd)
     }
 
     /* we should cleanup free_list and memroot, used by instruction */
-    thd->free_items();
+    thd->cleanup_after_query();
     free_root(&execute_mem_root, MYF(0));    
 
     /*
Thread
bk commit into 5.0 tree (ramil:1.2029) BUG#14304ramil1 Dec