mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix for bug#4312 ndb table, wrong behaviour on insert .. on duplicate key ..
This commit is contained in:
@ -78,9 +78,9 @@ unique key(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
insert into t1 values(3, 'AAA');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '3' for key 1
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
|
@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t1 values(8, 2, 3);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '8' for key 1
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
@ -65,7 +65,7 @@ select * from t2 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t2 values(8, 2, 3);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't2'
|
||||
ERROR 23000: Duplicate entry '8' for key 1
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
@ -123,7 +123,7 @@ pk a
|
||||
3 NULL
|
||||
4 4
|
||||
insert into t1 values (5,0);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
ERROR 23000: Duplicate entry '5' for key 1
|
||||
select * from t1 order by pk;
|
||||
pk a
|
||||
-1 NULL
|
||||
@ -156,7 +156,7 @@ pk a b c
|
||||
0 NULL 18 NULL
|
||||
1 3 19 abc
|
||||
insert into t2 values(2,3,19,'abc');
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't2'
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
select * from t2 order by pk;
|
||||
pk a b c
|
||||
-1 1 17 NULL
|
||||
|
@ -535,27 +535,46 @@ count(*)
|
||||
2000
|
||||
insert into t1 select * from t1 where b < 10 order by pk1;
|
||||
ERROR 23000: Duplicate entry '9' for key 1
|
||||
DELETE FROM t1 WHERE pk1=2;
|
||||
begin;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
commit;
|
||||
select * from t1 where pk1=1;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
2 3 4
|
||||
rollback;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
REPLACE INTO t1 values(1, 2, 3);
|
||||
2 3 4
|
||||
REPLACE INTO t1 values(1, 78, 3);
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
1 78 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
0 0 0
|
||||
1 79 3
|
||||
2 3 4
|
||||
3 79 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 4 3
|
||||
2 3 4
|
||||
3 6 3
|
||||
DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
|
||||
select * from t1 where pk1 = b and b != c order by pk1;
|
||||
pk1 b c
|
||||
2 2 17
|
||||
4 4 3
|
||||
6 6 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT) ENGINE=ndb;
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
|
Reference in New Issue
Block a user