Commit 4b852686 authored by unknown's avatar unknown

Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  salvation.intern.azundris.com:/home/tnurnberg/21913/my51-21913

parents de678389 5e9324a8
......@@ -253,7 +253,7 @@ create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) character set cp1251 default ''
`a` char(1) CHARACTER SET cp1251 DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
......
......@@ -432,22 +432,44 @@ ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
1
2
select last_insert_id(0);
last_insert_id(0)
0
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
0
select * from t2;
k a c
1 6 1
1 6 2
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
1
0
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 1
1 6 2
2 7 NULL
10 8 1
11 15 1
12 20 1
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 3
2 7 NULL
10 8 1
11 15 1
......
......@@ -204,16 +204,4 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
select a from t1 where a > 2;
delete from t1 where a < 4;
select a from t1 order by a;
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
select a from t1 where a > 4;
delete from t1 where a > 4;
select a from t1 order by a;
select a from t1 where a > 3;
delete from t1 where a >= 2;
select a from t1 order by a;
drop table t1;
--echo End of 5.0 tests
......@@ -369,8 +369,8 @@ insert into t1 values('aaa');
drop table t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
# row.
# UPDATE": if the row is updated, it's like a regular UPDATE:
# LAST_INSERT_ID() is not affected.
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
......@@ -390,6 +390,12 @@ insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
# test again when last_insert_id() is 0 initially
select last_insert_id(0);
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail:
......@@ -402,5 +408,14 @@ insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select * from t2;
drop table t2;
# Test of the workaround which enables people to know the id of the
# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
select * from t2;
drop table t2;
......@@ -1340,11 +1340,13 @@ subpartition by hash (a)
(SUBPARTITION subpart00, SUBPARTITION subpart01));
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
......@@ -1354,11 +1356,13 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart20, SUBPARTITION subpart21));
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
drop table t1;
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
......
......@@ -1145,16 +1145,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
}
info->updated++;
/*
If ON DUP KEY UPDATE updates a row instead of inserting one, and
there is an auto_increment column, then SELECT LAST_INSERT_ID()
returns the id of the updated row:
If ON DUP KEY UPDATE updates a row instead of inserting one, it's
like a regular UPDATE statement: it should not affect the value of a
next SELECT LAST_INSERT_ID() or mysql_insert_id().
Except if LAST_INSERT_ID(#) was in the INSERT query, which is
handled separately by THD::arg_of_last_insert_id_function.
*/
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
if (table->next_number_field)
{
longlong field_val= table->next_number_field->val_int();
thd->record_first_successful_insert_id_in_cur_stmt(field_val);
table->file->adjust_next_insert_id_after_explicit_value(field_val);
}
table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
trg_error= (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE));
......
......@@ -6,142 +6,142 @@
valgrind="valgrind --alignment=8 --leak-check=yes"
silent="-s"
if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
mi_test1$suffix $silent
myisamchk$suffix -se test1
mi_test1$suffix $silent -N -S
myisamchk$suffix -se test1
mi_test1$suffix $silent -P --checksum
myisamchk$suffix -se test1
mi_test1$suffix $silent -P -N -S
myisamchk$suffix -se test1
mi_test1$suffix $silent -B -N -R2
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -k 480 --unique
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -N -S -R1
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -S
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -S -N --unique
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -S -N --key_length=127 --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -S -N --key_length=128
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -S --key_length=480
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -B
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -B --key_length=64 --unique
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -B -k 480 --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -B -k 480 -N --unique --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -m
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -m -P --unique --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -m -P --key_length=480 --key_cache
myisamchk$suffix -sm test1
mi_test1$suffix $silent -m -p
myisamchk$suffix -sm test1
mi_test1$suffix $silent -w -S --unique
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -w --key_length=64 --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -w -N --key_length=480
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -w -S --key_length=480 --checksum
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -b -N
myisamchk$suffix -sm test1
mi_test1$suffix $silent -a -b --key_length=480
myisamchk$suffix -sm test1
mi_test1$suffix $silent -p -B --key_length=480
myisamchk$suffix -sm test1
if test -f mi_test1$MACH ; then suffix=$MACH ; else suffix=""; fi
./mi_test1$suffix $silent
./myisamchk$suffix -se test1
./mi_test1$suffix $silent -N -S
./myisamchk$suffix -se test1
./mi_test1$suffix $silent -P --checksum
./myisamchk$suffix -se test1
./mi_test1$suffix $silent -P -N -S
./myisamchk$suffix -se test1
./mi_test1$suffix $silent -B -N -R2
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -k 480 --unique
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -N -S -R1
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -S
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -S -N --unique
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -S -N --key_length=127 --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -S -N --key_length=128
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -S --key_length=480
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -B
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -B --key_length=64 --unique
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -B -k 480 --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -B -k 480 -N --unique --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -m
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -m -P --unique --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -m -P --key_length=480 --key_cache
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -m -p
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -w -S --unique
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -w --key_length=64 --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -w -N --key_length=480
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -w -S --key_length=480 --checksum
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -b -N
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -a -b --key_length=480
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent -p -B --key_length=480
./myisamchk$suffix -sm test1
mi_test1$suffix $silent --checksum
myisamchk$suffix -se test1
myisamchk$suffix -rs test1
myisamchk$suffix -se test1
myisamchk$suffix -rqs test1
myisamchk$suffix -se test1
myisamchk$suffix -rs --correct-checksum test1
myisamchk$suffix -se test1
myisamchk$suffix -rqs --correct-checksum test1
myisamchk$suffix -se test1
myisamchk$suffix -ros --correct-checksum test1
myisamchk$suffix -se test1
myisamchk$suffix -rqos --correct-checksum test1
myisamchk$suffix -se test1
./mi_test1$suffix $silent --checksum
./myisamchk$suffix -se test1
./myisamchk$suffix -rs test1
./myisamchk$suffix -se test1
./myisamchk$suffix -rqs test1
./myisamchk$suffix -se test1
./myisamchk$suffix -rs --correct-checksum test1
./myisamchk$suffix -se test1
./myisamchk$suffix -rqs --correct-checksum test1
./myisamchk$suffix -se test1
./myisamchk$suffix -ros --correct-checksum test1
./myisamchk$suffix -se test1
./myisamchk$suffix -rqos --correct-checksum test1
./myisamchk$suffix -se test1
# check of myisampack / myisamchk
myisampack$suffix --force -s test1
myisamchk$suffix -es test1
myisamchk$suffix -rqs test1
myisamchk$suffix -es test1
myisamchk$suffix -rs test1
myisamchk$suffix -es test1
myisamchk$suffix -rus test1
myisamchk$suffix -es test1
./myisampack$suffix --force -s test1
./myisamchk$suffix -es test1
./myisamchk$suffix -rqs test1
./myisamchk$suffix -es test1
./myisamchk$suffix -rs test1
./myisamchk$suffix -es test1
./myisamchk$suffix -rus test1
./myisamchk$suffix -es test1
mi_test1$suffix $silent --checksum -S
myisamchk$suffix -se test1
myisamchk$suffix -ros test1
myisamchk$suffix -rqs test1
myisamchk$suffix -se test1
./mi_test1$suffix $silent --checksum -S
./myisamchk$suffix -se test1
./myisamchk$suffix -ros test1
./myisamchk$suffix -rqs test1
./myisamchk$suffix -se test1
myisampack$suffix --force -s test1
myisamchk$suffix -rqs test1
myisamchk$suffix -es test1
myisamchk$suffix -rus test1
myisamchk$suffix -es test1
./myisampack$suffix --force -s test1
./myisamchk$suffix -rqs test1
./myisamchk$suffix -es test1
./myisamchk$suffix -rus test1
./myisamchk$suffix -es test1
mi_test1$suffix $silent --checksum --unique
myisamchk$suffix -se test1
mi_test1$suffix $silent --unique -S
myisamchk$suffix -se test1
./mi_test1$suffix $silent --checksum --unique
./myisamchk$suffix -se test1
./mi_test1$suffix $silent --unique -S
./myisamchk$suffix -se test1
mi_test1$suffix $silent --key_multiple -N -S
myisamchk$suffix -sm test1
mi_test1$suffix $silent --key_multiple -a -p --key_length=480
myisamchk$suffix -sm test1
mi_test1$suffix $silent --key_multiple -a -B --key_length=480
myisamchk$suffix -sm test1
mi_test1$suffix $silent --key_multiple -P -S
myisamchk$suffix -sm test1
./mi_test1$suffix $silent --key_multiple -N -S
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent --key_multiple -a -p --key_length=480
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent --key_multiple -a -B --key_length=480
./myisamchk$suffix -sm test1
./mi_test1$suffix $silent --key_multiple -P -S
./myisamchk$suffix -sm test1
mi_test2$suffix $silent -L -K -W -P
myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -K -W -P -A
myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -K -W -P -S -R1 -m500
./mi_test2$suffix $silent -L -K -W -P
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -L -K -W -P -A
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -L -K -W -P -S -R1 -m500
echo "mi_test2$suffix $silent -L -K -R1 -m2000 ; Should give error 135"
myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -K -R1 -m2000
myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -K -P -S -R3 -m50 -b1000000
myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -B
myisamchk$suffix -sm test2
mi_test2$suffix $silent -D -B -c
myisamchk$suffix -sm test2
mi_test2$suffix $silent -m10000 -e8192 -K
myisamchk$suffix -sm test2
mi_test2$suffix $silent -m10000 -e16384 -E16384 -K -L
myisamchk$suffix -sm test2
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -L -K -R1 -m2000
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -L -K -P -S -R3 -m50 -b1000000
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -L -B
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -D -B -c
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -m10000 -e8192 -K
./myisamchk$suffix -sm test2
./mi_test2$suffix $silent -m10000 -e16384 -E16384 -K -L
./myisamchk$suffix -sm test2
mi_test2$suffix $silent -L -K -W -P -m50 -l
myisamlog$suffix
mi_test2$suffix $silent -L -K -W -P -m50 -l -b100
myisamlog$suffix
time mi_test2$suffix $silent
time mi_test2$suffix $silent -K -B
time mi_test2$suffix $silent -L -B
time mi_test2$suffix $silent -L -K -B
time mi_test2$suffix $silent -L -K -W -B
time mi_test2$suffix $silent -L -K -W -S -B
time mi_test2$suffix $silent -D -K -W -S -B
./mi_test2$suffix $silent -L -K -W -P -m50 -l
./myisamlog$suffix
./mi_test2$suffix $silent -L -K -W -P -m50 -l -b100
./myisamlog$suffix
time ./mi_test2$suffix $silent
time ./mi_test2$suffix $silent -K -B
time ./mi_test2$suffix $silent -L -B
time ./mi_test2$suffix $silent -L -K -B
time ./mi_test2$suffix $silent -L -K -W -B
time ./mi_test2$suffix $silent -L -K -W -S -B
time ./mi_test2$suffix $silent -D -K -W -S -B
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment