Commit 816e84c1 authored by bell@book.sanja.is.com.ua's avatar bell@book.sanja.is.com.ua

Merge book.sanja.is.com.ua:/Users/bell/mysql/bk/mysql-4.1

into book.sanja.is.com.ua:/Users/bell/mysql/bk/work-4.1
parents b22e2aca 21bf35fc
This diff is collapsed.
...@@ -681,3 +681,13 @@ t3 1 a 1 a A NULL NULL NULL YES BTREE ...@@ -681,3 +681,13 @@ t3 1 a 1 a A NULL NULL NULL YES BTREE
t3 1 a 2 b A NULL NULL NULL YES BTREE t3 1 a 2 b A NULL NULL NULL YES BTREE
t3 1 a 3 c A NULL NULL NULL YES BTREE t3 1 a 3 c A NULL NULL NULL YES BTREE
drop table t1, t2, t3; drop table t1, t2, t3;
CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), UNIQUE (b) )
ENGINE=MyISAM;
CREATE TABLE t2 ( a INT AUTO_INCREMENT, b VARCHAR(10), INDEX (a), INDEX (b) )
ENGINE=MERGE UNION (t1) INSERT_METHOD=FIRST;
INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=2;
INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=3;
SELECT b FROM t2;
b
3
DROP TABLE t1, t2;
This diff is collapsed.
...@@ -306,3 +306,15 @@ show index from t3; ...@@ -306,3 +306,15 @@ show index from t3;
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE
#
CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), UNIQUE (b) )
ENGINE=MyISAM;
CREATE TABLE t2 ( a INT AUTO_INCREMENT, b VARCHAR(10), INDEX (a), INDEX (b) )
ENGINE=MERGE UNION (t1) INSERT_METHOD=FIRST;
INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=2;
INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=3;
SELECT b FROM t2;
DROP TABLE t1, t2;
This diff is collapsed.
...@@ -90,6 +90,7 @@ void ndbSetOwnVersion() {} ...@@ -90,6 +90,7 @@ void ndbSetOwnVersion() {}
#ifndef TEST_VERSION #ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(4,1,12), MAKE_VERSION(4,1,10), UG_Range },
{ MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact }, { MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact },
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact }, { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
{ MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact }, { MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
......
...@@ -37,7 +37,7 @@ class ha_myisammrg: public handler ...@@ -37,7 +37,7 @@ class ha_myisammrg: public handler
{ {
return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME | return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME |
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
HA_CAN_INSERT_DELAYED); HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE);
} }
ulong index_flags(uint inx, uint part, bool all_parts) const ulong index_flags(uint inx, uint part, bool all_parts) const
{ {
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define HA_HAS_CHECKSUM (1 << 24) #define HA_HAS_CHECKSUM (1 << 24)
/* Table data are stored in separate files (for lower_case_table_names) */ /* Table data are stored in separate files (for lower_case_table_names) */
#define HA_FILE_BASED (1 << 26) #define HA_FILE_BASED (1 << 26)
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
/* bits in index_flags(index_number) for what you can do with index */ /* bits in index_flags(index_number) for what you can do with index */
......
...@@ -682,7 +682,7 @@ int write_record(TABLE *table,COPY_INFO *info) ...@@ -682,7 +682,7 @@ int write_record(TABLE *table,COPY_INFO *info)
err: err:
if (key) if (key)
my_afree(key); my_safe_afree(key,table->max_unique_length,MAX_KEY_LENGTH);
info->last_errno= error; info->last_errno= error;
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -688,7 +688,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -688,7 +688,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
set_if_bigger(outparam->max_key_length,keyinfo->key_length+ set_if_bigger(outparam->max_key_length,keyinfo->key_length+
keyinfo->key_parts); keyinfo->key_parts);
outparam->total_key_length+= keyinfo->key_length; outparam->total_key_length+= keyinfo->key_length;
if (keyinfo->flags & HA_NOSAME) /*
MERGE tables do not have unique indexes. But every key could be
an unique index on the underlying MyISAM table. (Bug #10400)
*/
if ((keyinfo->flags & HA_NOSAME) ||
(ha_option & HA_ANY_INDEX_MAY_BE_UNIQUE))
set_if_bigger(outparam->max_unique_length,keyinfo->key_length); set_if_bigger(outparam->max_unique_length,keyinfo->key_length);
} }
if (primary_key < MAX_KEY && if (primary_key < MAX_KEY &&
......
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