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