diff options
-rw-r--r-- | Docs/manual.texi | 6 | ||||
-rw-r--r-- | mysql-test/r/insert_select.result | 2 | ||||
-rw-r--r-- | mysql-test/t/insert_select.test | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 8 |
5 files changed, 18 insertions, 3 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index a4e40f865d8..35a23422d27 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -9686,6 +9686,10 @@ version 4.0; @itemize @bullet @item +@code{INSERT INTO ... SELECT} had in 3.23 always @code{IGNORE} enabled. +In 4.0.1 MySQL will stop (and possible rollback) in case of an error if you +don't specify @code{IGNORE}. +@item @file{safe_mysqld} is renamed to @file{mysqld_safe}. @item The old C API functions @code{mysql_drop_db}, @code{mysql_create_db} and @@ -48867,6 +48871,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item +Changed @code{INSERT INTO .. SELECT} to by default stop on errors. +@item Ignore @code{DATA DIRECTORY} and @code{INDEX DIRECTORY} directives on windows. @item Added boolean fulltext search code. It should be considered early alpha. diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 682e711a6e8..d61b6c67030 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -4,6 +4,8 @@ insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7, create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1; insert into t2 (payoutID) SELECT payoutID+10 FROM t1; +Duplicate entry '16' for key 1 +insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; payoutID 1 diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 30d3e31188c..42f65858d77 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -7,7 +7,9 @@ create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLI insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12); create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1; +--error 1062 insert into t2 (payoutID) SELECT payoutID+10 FROM t1; +insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; # diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d6c9437e93c..3830db48613 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1626,8 +1626,7 @@ mysql_execute_command(void) if (!(res=open_and_lock_tables(thd, tables))) { if ((result=new select_insert(tables->table,&lex->field_list, - lex->sql_command == SQLCOM_REPLACE_SELECT ? - DUP_REPLACE : DUP_IGNORE))) + lex->duplicates))) res=handle_select(thd,lex,result); } else diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e34f42bdfde..ee8a0ae930d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2188,7 +2188,13 @@ insert: INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option opt_ignore insert2 insert_field_spec replace: - REPLACE { Lex->sql_command = SQLCOM_REPLACE; } replace_lock_option insert2 insert_field_spec + REPLACE + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_REPLACE; + lex->duplicates= DUP_REPLACE; + } + replace_lock_option insert2 insert_field_spec insert_lock_option: /* empty */ { Lex->lock_option= TL_WRITE_CONCURRENT_INSERT; } |