List:Commits« Previous MessageNext Message »
From:<gshchepa Date:April 25 2007 7:57pm
Subject:bk commit into 5.0 tree (gshchepa:1.2461) BUG#27650
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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-04-25 22:56:59+05:00, gshchepa@stripped +3 -0
  Bug#27650: InnoDB handler doesn't save next autoincrement value after
  updating of  auto_increment column ('auto' in the samples below) with
  NULL values inside multi-row INSERT via ON DUPLICATE KEY UPDATE using
  auto=VALUES(auto).
  InnoDB handler fixed.

  mysql-test/r/innodb_mysql.result@stripped, 2007-04-25 22:53:06+05:00, gshchepa@stripped
+40 -0
    Bug#27650: InnoDB handler doesn't save next autoincrement value after
    updating of  auto_increment column ('auto' in the samples below) with
    NULL values inside multi-row INSERT via ON DUPLICATE KEY UPDATE using
    auto=VALUES(auto).
    Test case updated.

  mysql-test/t/innodb_mysql.test@stripped, 2007-04-25 22:52:30+05:00, gshchepa@stripped
+53 -0
    Bug#27650: InnoDB handler doesn't save next autoincrement value after
    updating of  auto_increment column ('auto' in the samples below) with
    NULL values inside multi-row INSERT via ON DUPLICATE KEY UPDATE using
    auto=VALUES(auto).Test case updated.

  sql/ha_innodb.cc@stripped, 2007-04-25 22:53:40+05:00, gshchepa@stripped +2 -0
    Bug#27650: InnoDB handler doesn't save next autoincrement value after
    updating of  auto_increment column ('auto' in the samples below) with
    NULL values inside multi-row INSERT via ON DUPLICATE KEY UPDATE using
    auto=VALUES(auto).
    Fixed.

# 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:	gshchepa
# Host:	gshchepa.loc
# Root:	/home/uchum/work/bk-trees/mysql-5.0-opt-27650

--- 1.16/mysql-test/r/innodb_mysql.result	2007-02-11 11:55:54 +04:00
+++ 1.17/mysql-test/r/innodb_mysql.result	2007-04-25 22:53:06 +05:00
@@ -446,4 +446,44 @@ a
 2
 5
 drop table t1;
+drop table if exists `t1`;
+create table t1 
+(auto int auto_increment,
+c char(1) not null,
+counter int not null default 1,
+primary key (auto),
+unique key (c)
+) engine=innodb;
+insert into t1 (auto, c) values
+(NULL, 'a'),
+(NULL, 'a')
+on duplicate key update auto = values(auto), counter = counter + 1;
+select * from t1;
+auto	c	counter
+2	a	2
+insert into t1 (auto, c) values
+(NULL, 'b')
+on duplicate key update auto = values(auto), counter = counter + 1;
+select * from t1;
+auto	c	counter
+2	a	2
+3	b	1
+truncate table t1;
+insert into t1 (auto, c) values (NULL, 'a');
+select * from t1;
+auto	c	counter
+1	a	1
+insert into t1 (auto, c) values (NULL, 'b'), (NULL, 'b')
+on duplicate key update auto = values(auto), c = values(c), counter = counter + 1;
+select * from t1;
+auto	c	counter
+1	a	1
+3	b	2
+insert into t1 (auto, c) values (NULL, 'a')
+on duplicate key update auto = values(auto), c = values(c), counter = counter + 1;
+select * from t1;
+auto	c	counter
+3	b	2
+4	a	2
+drop table t1;
 End of 5.0 tests

--- 1.16/mysql-test/t/innodb_mysql.test	2007-02-11 11:55:54 +04:00
+++ 1.17/mysql-test/t/innodb_mysql.test	2007-04-25 22:52:30 +05:00
@@ -412,4 +412,57 @@ DROP TABLE t1;
 
 --source include/innodb_rollback_on_timeout.inc
 
+
+-- source include/have_innodb.inc
+
+#
+# Bug#27650: InnoDB handler doesn't save next autoincrement value after
+# updating of  auto_increment column ('auto' in the samples below) with
+# NULL values inside multi-row INSERT via ON DUPLICATE KEY UPDATE using
+# auto=VALUES(auto).
+#
+
+--disable_warnings
+drop table if exists `t1`;
+--enable_warnings
+
+create table t1 
+(auto int auto_increment,
+c char(1) not null,
+counter int not null default 1,
+primary key (auto),
+unique key (c)
+) engine=innodb;
+
+insert into t1 (auto, c) values
+(NULL, 'a'),
+(NULL, 'a')
+on duplicate key update auto = values(auto), counter = counter + 1;
+
+select * from t1;
+
+insert into t1 (auto, c) values
+(NULL, 'b')
+on duplicate key update auto = values(auto), counter = counter + 1;
+
+select * from t1;
+
+truncate table t1;
+
+insert into t1 (auto, c) values (NULL, 'a');
+
+select * from t1;
+
+insert into t1 (auto, c) values (NULL, 'b'), (NULL, 'b')
+on duplicate key update auto = values(auto), c = values(c), counter = counter + 1;
+
+select * from t1;
+
+insert into t1 (auto, c) values (NULL, 'a')
+on duplicate key update auto = values(auto), c = values(c), counter = counter + 1;
+
+select * from t1;
+
+drop table t1;
+
 --echo End of 5.0 tests

--- 1.310/sql/ha_innodb.cc	2007-03-23 00:40:46 +04:00
+++ 1.311/sql/ha_innodb.cc	2007-04-25 22:53:40 +05:00
@@ -3299,6 +3299,8 @@ no_commit:
         if (error == DB_DUPLICATE_KEY && auto_inc_used
             && (user_thd->lex->sql_command == SQLCOM_REPLACE
                 || user_thd->lex->sql_command == SQLCOM_REPLACE_SELECT
+                || (user_thd->lex->sql_command == SQLCOM_INSERT
+                    && user_thd->lex->duplicates == DUP_UPDATE)
                 || (user_thd->lex->sql_command == SQLCOM_LOAD
                     && user_thd->lex->duplicates == DUP_REPLACE))) {
 
Thread
bk commit into 5.0 tree (gshchepa:1.2461) BUG#27650gshchepa25 Apr