List:Commits« Previous MessageNext Message »
From:dlenev Date:January 25 2007 11:58am
Subject:bk commit into 5.1 tree (dlenev:1.2408)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of dlenev. When dlenev 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-01-25 14:58:45+03:00, dlenev@stripped +2 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
  into  mockturtle.local:/home/dlenev/src/mysql-5.1-merge
  MERGE: 1.2403.1.4

  mysql-test/t/sp-error.test@stripped, 2007-01-25 14:58:41+03:00, dlenev@stripped +0 -0
    Auto merged
    MERGE: 1.115.1.2

  sql/sql_table.cc@stripped, 2007-01-25 14:58:41+03:00, dlenev@stripped +0 -0
    Auto merged
    MERGE: 1.382.1.1

# 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:	dlenev
# Host:	mockturtle.local
# Root:	/home/dlenev/src/mysql-5.1-merge/RESYNC

--- 1.384/sql/sql_table.cc	2007-01-25 14:58:52 +03:00
+++ 1.385/sql/sql_table.cc	2007-01-25 14:58:52 +03:00
@@ -6841,7 +6841,7 @@ copy_data_between_tables(TABLE *from,TAB
            uint key_nr= to->file->get_dup_key(error);
            if ((int) key_nr >= 0)
            {
-             const char *err_msg= ER(ER_DUP_ENTRY);
+             const char *err_msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
              if (key_nr == 0 &&
                  (to->key_info[0].key_part[0].field->flags &
                   AUTO_INCREMENT_FLAG))

--- 1.116/mysql-test/t/sp-error.test	2007-01-25 14:58:52 +03:00
+++ 1.117/mysql-test/t/sp-error.test	2007-01-25 14:58:52 +03:00
@@ -1813,6 +1813,38 @@ DROP TABLE t1;
 
 
 #
+# BUG#24491 "using alias from source table in insert ... on duplicate key"
+#
+--disable_warnings
+drop tables if exists t1;
+drop procedure if exists bug24491;
+--enable_warnings
+create table t1 (id int primary key auto_increment, value varchar(10));
+insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
+# Let us create routine with INSERT ... SELECT ... ON DUPLICATE KEY UPDATE 
+# statement which in its ON DUPLICATE KEY clause erroneously tries to assign
+# value to a column which is mentioned only in SELECT part.
+create procedure bug24491()
+  insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP';
+# Both first and second calls to it should fail
+--error ER_BAD_FIELD_ERROR 
+call bug24491();
+--error ER_BAD_FIELD_ERROR
+call bug24491();
+drop procedure bug24491;
+# And now the same test for more complex case which is more close
+# to the one that was reported originally.
+create procedure bug24491()
+  insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP';
+--error ER_BAD_FIELD_ERROR 
+call bug24491();
+--error ER_BAD_FIELD_ERROR
+call bug24491();
+drop procedure bug24491;
+drop tables t1;
+
+
+#
 # End of 5.0 tests
 #
 --echo End of 5.0 tests
@@ -1852,6 +1884,7 @@ drop function bug20701;
 
 
 --echo End of 5.1 tests
+
 
 #
 # BUG#NNNN: New bug synopsis
Thread
bk commit into 5.1 tree (dlenev:1.2408)dlenev25 Jan