Commit 24f9a2e9 authored by mskold@mysql.com's avatar mskold@mysql.com

Added ORDER BY to ensure same result on all setups/platforms

parent 4dd1fc01
...@@ -6,33 +6,33 @@ attr2 INT, ...@@ -6,33 +6,33 @@ attr2 INT,
attr3 VARCHAR(10) attr3 VARCHAR(10)
) ENGINE=ndbcluster; ) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SELECT pk1 FROM t1; SELECT pk1 FROM t1 ORDER BY pk1;
pk1 pk1
9410 9410
9411 9411
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
9410 9412 NULL 9412 9410 9412 NULL 9412
9411 9413 17 9413 9411 9413 17 9413
SELECT t1.* FROM t1; SELECT t1.* FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
9410 9412 NULL 9412 9410 9412 NULL 9412
9411 9413 17 9413 9411 9413 17 9413
UPDATE t1 SET attr1=1 WHERE pk1=9410; UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
9410 1 NULL 9412 9410 1 NULL 9412
9411 9413 17 9413 9411 9413 17 9413
UPDATE t1 SET pk1=2 WHERE attr1=1; UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
2 1 NULL 9412 2 1 NULL 9412
9411 9413 17 9413 9411 9413 17 9413
UPDATE t1 SET pk1=pk1 + 1; UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
9412 9413 17 9413
3 1 NULL 9412 3 1 NULL 9412
9412 9413 17 9413
DELETE FROM t1; DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
...@@ -115,13 +115,17 @@ SELECT * FROM t1; ...@@ -115,13 +115,17 @@ SELECT * FROM t1;
id id2 id id2
1234 7890 1234 7890
DELETE FROM t1; DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890); INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
SELECT * FROM t1; SELECT * FROM t1 ORDER BY id;
id id2 id id2
3454 7890
3456 7890 3456 7890
3456 7890 3456 7890
3456 7890 3456 7890
DELETE FROM t1 WHERE id = 3456; DELETE FROM t1 WHERE id = 3456;
SELECT * FROM t1 ORDER BY id;
id id2
3454 7890
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY, pk1 INT NOT NULL PRIMARY KEY,
......
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb; create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
insert into t1 values (1,'one'), (2,'two'); insert into t1 values (1,'one'), (2,'two');
select * from t1; select * from t1 order by x;
x y x y
2 two
1 one 1 one
select * from t1;
x y
2 two 2 two
select * from t1 order by x;
x y
1 one 1 one
2 two
start transaction; start transaction;
insert into t1 values (3,'three'); insert into t1 values (3,'three');
start transaction; select * from t1 order by x;
select * from t1;
x y x y
1 one
2 two 2 two
3 three
start transaction;
select * from t1 order by x;
x y
1 one 1 one
2 two
commit; commit;
select * from t1; select * from t1 order by x;
x y x y
1 one
2 two 2 two
3 three 3 three
1 one
commit; commit;
...@@ -21,19 +21,19 @@ CREATE TABLE t1 ( ...@@ -21,19 +21,19 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SELECT pk1 FROM t1; SELECT pk1 FROM t1 ORDER BY pk1;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
SELECT t1.* FROM t1; SELECT t1.* FROM t1 ORDER BY pk1;
# Update on record by primary key # Update on record by primary key
UPDATE t1 SET attr1=1 WHERE pk1=9410; UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
# Update primary key # Update primary key
UPDATE t1 SET pk1=2 WHERE attr1=1; UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
UPDATE t1 SET pk1=pk1 + 1; UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
# Delete the record # Delete the record
DELETE FROM t1; DELETE FROM t1;
...@@ -85,9 +85,10 @@ UPDATE t1 SET id=1234 WHERE id2=7890; ...@@ -85,9 +85,10 @@ UPDATE t1 SET id=1234 WHERE id2=7890;
SELECT * FROM t1; SELECT * FROM t1;
DELETE FROM t1; DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890); INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
SELECT * FROM t1; SELECT * FROM t1 ORDER BY id;
DELETE FROM t1 WHERE id = 3456; DELETE FROM t1 WHERE id = 3456;
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -19,20 +19,23 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; ...@@ -19,20 +19,23 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
connection con1; connection con1;
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb; create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
insert into t1 values (1,'one'), (2,'two'); insert into t1 values (1,'one'), (2,'two');
select * from t1; select * from t1 order by x;
connection con2; connection con2;
select * from t1; select * from t1 order by x;
connection con1; connection con1;
start transaction; insert into t1 values (3,'three'); start transaction;
insert into t1 values (3,'three');
select * from t1 order by x;
connection con2; connection con2;
start transaction; select * from t1; start transaction;
select * from t1 order by x;
connection con1; connection con1;
commit; commit;
connection con2; connection con2;
select * from t1; select * from t1 order by x;
commit; commit;
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