mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into mysql.com:/d2/hf/mrg/mysql-5.1-opt mysql-test/r/alter_table.result: Auto merged mysql-test/r/distinct.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/r/query_cache.result: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged BitKeeper/deleted/.del-ps_6bdb.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysys/my_error.c: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_sum.cc: Auto merged sql/key.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/include/mix1.inc: merging mysql-test/r/group_by.result: SCCS merged mysql-test/r/innodb_mysql.result: merging mysql-test/r/join.result: merging mysql-test/r/subselect.result: merging mysql-test/r/type_datetime.result: SCCS merged mysql-test/r/windows.result: SCCS merged mysql-test/t/group_by.test: SCCS merged mysql-test/t/join.test: merging mysql-test/t/subselect.test: merging mysql-test/t/type_datetime.test: merging mysql-test/t/windows.test: SCCS merged sql/item_timefunc.cc: merging sql/sql_base.cc: SCCS merged storage/innobase/handler/ha_innodb.cc: merging
This commit is contained in:
@ -112,6 +112,39 @@ c1
|
||||
Before and after comparison
|
||||
0
|
||||
drop table t1;
|
||||
CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
create table t1m (a int) engine = MEMORY;
|
||||
create table t1i (a int);
|
||||
@ -387,7 +420,45 @@ a
|
||||
2
|
||||
5
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
create table t1(
|
||||
id int auto_increment,
|
||||
c char(1) not null,
|
||||
counter int not null default 1,
|
||||
primary key (id),
|
||||
unique key (c)
|
||||
) engine=innodb;
|
||||
insert into t1 (id, c) values
|
||||
(NULL, 'a'),
|
||||
(NULL, 'a')
|
||||
on duplicate key update id = values(id), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
2 a 2
|
||||
insert into t1 (id, c) values
|
||||
(NULL, 'b')
|
||||
on duplicate key update id = values(id), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
2 a 2
|
||||
3 b 1
|
||||
truncate table t1;
|
||||
insert into t1 (id, c) values (NULL, 'a');
|
||||
select * from t1;
|
||||
id c counter
|
||||
1 a 1
|
||||
insert into t1 (id, c) values (NULL, 'b'), (NULL, 'b')
|
||||
on duplicate key update id = values(id), c = values(c), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
1 a 1
|
||||
3 b 2
|
||||
insert into t1 (id, c) values (NULL, 'a')
|
||||
on duplicate key update id = values(id), c = values(c), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
3 b 2
|
||||
4 a 2
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||
|
Reference in New Issue
Block a user