Don't use IGNORE by default in INSERT ... SELECT
Docs/manual.texi: Changelog mysql-test/r/insert_select.result: Add testcase for INSERT IGNORE mysql-test/t/insert_select.test: Add testcase for INSERT IGNORE
This commit is contained in:
parent
356003a8c9
commit
897e7453d6
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
#
|
||||
|
@ -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
|
||||
|
@ -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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user