summaryrefslogtreecommitdiff
path: root/mysql-test/t/ndb_replace.test
blob: 6cad80ef8ea5badddc06087c55a8ed5d9ad6691f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- source include/have_ndb.inc
-- source include/not_embedded.inc

#
# Test of REPLACE with NDB
#

--disable_warnings
drop table if exists t1;
--enable_warnings

CREATE TABLE t1 (
  gesuchnr int(11) DEFAULT '0' NOT NULL,
  benutzer_id int(11) DEFAULT '0' NOT NULL,
  PRIMARY KEY (gesuchnr,benutzer_id)
) engine=ndbcluster;

replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
--error 1062
insert into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
drop table t1;

# bug#17431
CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT, 
                j INT, 
                k INT, 
                UNIQUE INDEX(j)
               ) ENGINE = ndb;
INSERT  INTO t1 VALUES (1,1,23),(2,2,24);
REPLACE INTO t1 (j,k) VALUES (1,42);
REPLACE INTO t1 (i,j) VALUES (17,2);
SELECT * from t1 ORDER BY i;

# End of 4.1 tests