Commit 12920c2e authored by tomas@whalegate.ndb.mysql.com's avatar tomas@whalegate.ndb.mysql.com

Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
parents 248c4ac9 186d1534
...@@ -770,35 +770,6 @@ c abc ab ...@@ -770,35 +770,6 @@ c abc ab
d ab ab d ab ab
e abc abc e abc abc
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
b VARCHAR(255) NOT NULL,
c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
create table t1 (a int not null primary key, b int) engine=ndb;
insert into t1 values(1,1),(2,2),(3,3);
create table t2 like t1;
insert into t2 select * from t1;
select * from t1 order by a;
a b
1 1
2 2
3 3
select * from t2 order by a;
a b
1 1
2 2
3 3
drop table t1, t2;
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table t2 like t1;
rename table t1 to t10, t2 to t20;
drop table t10,t20;
create table t1 (a int not null primary key, b int not null) engine=ndb; create table t1 (a int not null primary key, b int not null) engine=ndb;
create table t2 (a int not null primary key, b int not null) engine=ndb; create table t2 (a int not null primary key, b int not null) engine=ndb;
insert into t1 values (1,10), (2,20), (3,30); insert into t1 values (1,10), (2,20), (3,30);
...@@ -867,7 +838,36 @@ select * from t1 order by a; ...@@ -867,7 +838,36 @@ select * from t1 order by a;
a b a b
1 10 1 10
2 10 2 10
3 1 3 30
4 1 4 1
drop table t1,t2; drop table t1,t2;
End of 5.0 tests
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
b VARCHAR(255) NOT NULL,
c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
create table t1 (a int not null primary key, b int) engine=ndb;
insert into t1 values(1,1),(2,2),(3,3);
create table t2 like t1;
insert into t2 select * from t1;
select * from t1 order by a;
a b
1 1
2 2
3 3
select * from t2 order by a;
a b
1 1
2 2
3 3
drop table t1, t2;
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table t2 like t1;
rename table t1 to t10, t2 to t20;
drop table t10,t20;
End of 5.1 tests End of 5.1 tests
...@@ -752,6 +752,46 @@ INSERT INTO t1 VALUES ...@@ -752,6 +752,46 @@ INSERT INTO t1 VALUES
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
DROP TABLE t1; DROP TABLE t1;
# delete
create table t1 (a int not null primary key, b int not null) engine=ndb;
create table t2 (a int not null primary key, b int not null) engine=ndb;
insert into t1 values (1,10), (2,20), (3,30);
insert into t2 values (1,10), (2,20), (3,30);
select * from t1 order by a;
delete from t1 where a > 0 order by a desc limit 1;
select * from t1 order by a;
delete from t1,t2 using t1,t2 where t1.a = t2.a;
select * from t2 order by a;
drop table t1,t2;
# insert ignore
create table t1 (a int not null primary key, b int not null) engine=ndb;
insert into t1 values (1,10), (2,20), (3,30);
--error ER_DUP_ENTRY
insert into t1 set a=1, b=100;
insert ignore into t1 set a=1, b=100;
select * from t1 order by a;
insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
select * from t1 order by a;
drop table t1;
# update
create table t1 (a int not null primary key, b int not null) engine=ndb;
create table t2 (c int not null primary key, d int not null) engine=ndb;
insert into t1 values (1,10), (2,10), (3,30), (4, 30);
insert into t2 values (1,10), (2,10), (3,30), (4, 30);
--error ER_DUP_ENTRY
update t1 set a = 1 where a = 3;
select * from t1 order by a;
update t1 set b = 1 where a > 1 order by a desc limit 1;
select * from t1 order by a;
--error ER_DUP_ENTRY
update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
select * from t1 order by a;
update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
select * from t1 order by a;
drop table t1,t2;
# End of 5.0 tests # End of 5.0 tests
--echo End of 5.0 tests --echo End of 5.0 tests
......
...@@ -2905,7 +2905,8 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) ...@@ -2905,7 +2905,8 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
* If IGNORE the ignore constraint violations on primary and unique keys, * If IGNORE the ignore constraint violations on primary and unique keys,
* but check that it is not part of INSERT ... ON DUPLICATE KEY UPDATE * but check that it is not part of INSERT ... ON DUPLICATE KEY UPDATE
*/ */
if (m_ignore_dup_key && thd->lex->sql_command == SQLCOM_UPDATE) if (m_ignore_dup_key && (thd->lex->sql_command == SQLCOM_UPDATE ||
thd->lex->sql_command == SQLCOM_UPDATE_MULTI))
{ {
int peek_res= peek_indexed_rows(new_data, pk_update); int peek_res= peek_indexed_rows(new_data, pk_update);
......
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