summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2006-02-10 17:40:22 +0100
committerunknown <tomas@poseidon.ndb.mysql.com>2006-02-10 17:40:22 +0100
commit26287714d5c2096ad04375769d49e0d972e4be59 (patch)
tree025d5a61e7e7053be75d39d01e4a7e24ac99c6c3 /mysql-test
parent523d97f4ddfe695ca6134a65d93a24f388e52a4c (diff)
downloadmariadb-git-26287714d5c2096ad04375769d49e0d972e4be59.tar.gz
Bug #17249 ndb, delete statement with join where clause fails when table do not have pk
Bug #17257 ndb, update fails for inner joins if tables do not have Primary Key change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead mysql-test/r/ndb_basic.result: Bug #17249 delete statement with join where clause fails when table do not have pk Bug #17257 update fails for inner joins if tables do not have Primary Key mysql-test/t/ndb_basic.test: Bug #17249 delete statement with join where clause fails when table do not have pk Bug #17257 update fails for inner joins if tables do not have Primary Key sql/ha_ndbcluster.cc: Bug #17249 delete statement with join where clause fails when table do not have pk Bug #17257 update fails for inner joins if tables do not have Primary Key change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead sql/ha_ndbcluster.h: Bug #17249 delete statement with join where clause fails when table do not have pk Bug #17257 update fails for inner joins if tables do not have Primary Key change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ndb_basic.result55
-rw-r--r--mysql-test/t/ndb_basic.test66
2 files changed, 121 insertions, 0 deletions
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 42b5a39d3d8..68c8bc01a14 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -671,3 +671,58 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
b
drop table t1;
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+a
+select * from t2;
+a
+1
+drop table t1;
+drop table t2;
+CREATE TABLE t1 (
+i INT,
+j INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+CREATE TABLE t2 (
+i INT,
+k INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+CREATE TABLE t3 (
+j INT,
+k INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ON a.i = b.i
+INNER JOIN t3 AS c
+ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT sum(z)
+FROM t3
+WHERE y = 34
+)
+WHERE b.x = 23;
+select * from t1;
+i j x y z
+1 2 23 24 71
+drop table t1;
+drop table t2;
+drop table t3;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index c8cf5823500..fdc87382308 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -614,4 +614,70 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
drop table t1;
+#
+# Bug #17249 delete statement with join where clause fails
+# when table do not have pk
+#
+
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+select * from t2;
+drop table t1;
+drop table t2;
+
+#
+# Bug #17257 update fails for inner joins if tables
+# do not have Primary Key
+#
+
+CREATE TABLE t1 (
+ i INT,
+ j INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+CREATE TABLE t2 (
+ i INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+CREATE TABLE t3 (
+ j INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ ON a.i = b.i
+INNER JOIN t3 AS c
+ ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+ a.y = b.y,
+ a.z = (
+ SELECT sum(z)
+ FROM t3
+ WHERE y = 34
+ )
+WHERE b.x = 23;
+select * from t1;
+drop table t1;
+drop table t2;
+drop table t3;
+
# End of 4.1 tests