summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/april.(none)>2007-03-13 18:11:47 +0400
committerunknown <svoj@mysql.com/april.(none)>2007-03-13 18:11:47 +0400
commit968d1695a76f153bfe2007ff63ed1cbeb8b63a59 (patch)
tree63faafb45210085d9f6afc7913c41db4a4d9b22d
parent063c95e6f07a07a518f9ea8469dbd3e30b3a4a34 (diff)
parent969b71653d434ce1d3447f6c99c331a22ba4f846 (diff)
downloadmariadb-git-968d1695a76f153bfe2007ff63ed1cbeb8b63a59.tar.gz
Merge mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-4.1-engines
into mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.0-engines myisam/mi_create.c: Auto merged mysql-test/t/merge.test: Auto merged sql/ha_myisam.cc: Auto merged sql/sql_parse.cc: Use local. mysql-test/r/merge.result: SCCS merged
-rw-r--r--myisam/mi_create.c4
-rw-r--r--mysql-test/r/merge.result13
-rw-r--r--mysql-test/t/merge.test17
-rw-r--r--sql/ha_myisam.cc37
4 files changed, 70 insertions, 1 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index d46672444e0..ea1d8c7b83e 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -157,6 +157,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
rec--;
if (rec->type == (int) FIELD_SKIP_ZERO && rec->length == 1)
{
+ /*
+ NOTE1: here we change a field type FIELD_SKIP_ZERO ->
+ FIELD_NORMAL
+ */
rec->type=(int) FIELD_NORMAL;
packed--;
min_pack_length++;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index c4e31da6cb3..e45e5853c0c 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -808,6 +808,19 @@ CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
INSERT DELAYED INTO t2 VALUES(1);
ERROR HY000: Table storage engine for 't2' doesn't have this option
DROP TABLE t1, t2;
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1
+DROP TABLE t1, m1;
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+DROP TABLE t1, m1;
create table t1 (b bit(1));
create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2);
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index b059613b570..07923fa020c 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -439,6 +439,23 @@ CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
INSERT DELAYED INTO t2 VALUES(1);
DROP TABLE t1, t2;
+#
+# BUG#26881 - Large MERGE tables report incorrect specification when no
+# differences in tables
+#
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+ c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
# End of 4.1 tests
#
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index dd00c91e4af..10d3dbb2ec5 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -342,6 +342,12 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
RETURN VALUE
0 - Equal definitions.
1 - Different definitions.
+
+ TODO
+ - compare FULLTEXT keys;
+ - compare SPATIAL keys;
+ - compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly
+ (should be corretly detected in table2myisam).
*/
int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
@@ -367,6 +373,28 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg;
HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg;
+ if (t1_keyinfo[i].flag & HA_FULLTEXT && t2_keyinfo[i].flag & HA_FULLTEXT)
+ continue;
+ else if (t1_keyinfo[i].flag & HA_FULLTEXT ||
+ t2_keyinfo[i].flag & HA_FULLTEXT)
+ {
+ DBUG_PRINT("error", ("Key %d has different definition", i));
+ DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
+ test(t1_keyinfo[i].flag & HA_FULLTEXT),
+ test(t2_keyinfo[i].flag & HA_FULLTEXT)));
+ DBUG_RETURN(1);
+ }
+ if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL)
+ continue;
+ else if (t1_keyinfo[i].flag & HA_SPATIAL ||
+ t2_keyinfo[i].flag & HA_SPATIAL)
+ {
+ DBUG_PRINT("error", ("Key %d has different definition", i));
+ DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
+ test(t1_keyinfo[i].flag & HA_SPATIAL),
+ test(t2_keyinfo[i].flag & HA_SPATIAL)));
+ DBUG_RETURN(1);
+ }
if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs ||
t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg)
{
@@ -403,7 +431,14 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
MI_COLUMNDEF *t1_rec= &t1_recinfo[i];
MI_COLUMNDEF *t2_rec= &t2_recinfo[i];
- if (t1_rec->type != t2_rec->type ||
+ /*
+ FIELD_SKIP_ZERO can be changed to FIELD_NORMAL in mi_create,
+ see NOTE1 in mi_create.c
+ */
+ if ((t1_rec->type != t2_rec->type &&
+ !(t1_rec->type == (int) FIELD_SKIP_ZERO &&
+ t1_rec->length == 1 &&
+ t2_rec->type == (int) FIELD_NORMAL)) ||
t1_rec->length != t2_rec->length ||
t1_rec->null_bit != t2_rec->null_bit)
{