summaryrefslogtreecommitdiff
path: root/mysql-test/t/merge.test
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/june.mysql.com>2007-01-31 16:15:20 +0400
committerunknown <svoj@mysql.com/june.mysql.com>2007-01-31 16:15:20 +0400
commitf7b3c7c531cb4cc3960e64c96a670949ee3a2ffa (patch)
tree2dc7d4b8ebc18a666880e1c94c5f4c8878d0432d /mysql-test/t/merge.test
parent402c0426ff172b5cbe97ab222929bcd2f20cabba (diff)
downloadmariadb-git-f7b3c7c531cb4cc3960e64c96a670949ee3a2ffa.tar.gz
WL#3567 - MERGE engine: a check for underlying table conformance
When a merge table is opened compare column and key definition of underlying tables against column and key definition of merge table. If any of underlying tables have different column/key definition refuse to open merge table. mysql-test/r/merge.result: A test case for WL#3456. mysql-test/t/merge.test: A test case for WL#3456. sql/ha_myisam.cc: Moved a part of code that converts TABLE object to MyISAM key and column definition to a separate function. Added check_definition() function that compares MyISAM table definitions. sql/ha_myisammrg.cc: Check if underlying table definition conforms to merge table definition, and in case underlying table definition differs, refuse to open merge table.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r--mysql-test/t/merge.test29
1 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index bb03b7b8d62..700a807e62c 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -383,7 +383,7 @@ drop table t1, t2, t3;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1030
+--error 1168
SELECT * FROM t2 WHERE a=2;
DROP TABLE t1, t2;
@@ -401,4 +401,31 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
SELECT * FROM t2;
DROP TABLE t2;
+#
+# Underlying table definition conformance tests.
+#
+CREATE TABLE t1(a INT, b TEXT);
+CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
+--error 1168
+SELECT * FROM tm1;
+DROP TABLE t1, tm1;
+
+CREATE TABLE t1(a SMALLINT, b SMALLINT);
+CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
+--error 1168
+SELECT * FROM tm1;
+DROP TABLE t1, tm1;
+
+CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
+CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
+--error 1168
+SELECT * FROM tm1;
+DROP TABLE t1, tm1;
+
+CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
+CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
+--error 1168
+SELECT * FROM tm1;
+DROP TABLE t1, tm1;
+
# End of 4.1 tests