summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authoringo@mysql.com <>2005-05-18 19:40:39 +0200
committeringo@mysql.com <>2005-05-18 19:40:39 +0200
commit26f2e57ecbda0ffe0d4066d4abc8b9f65c51c0f4 (patch)
treeeed6d6e4fb1b732cbfe4e1d82ab99868c7ac0e3e /sql/table.cc
parentcc1354541398ada02dec96ed0fb239fdd587c6f0 (diff)
downloadmariadb-git-26f2e57ecbda0ffe0d4066d4abc8b9f65c51c0f4.tar.gz
Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE
After review version. Added a condition for MERGE tables. These do not have unique indexes. But every key could be a unique key on the underlying MyISAM table. So get the maximum key length for MERGE tables instead of the maximum unique key length. This is used for buffer allocation in write_record().
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 012defa116d..d9000933ee0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -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+
keyinfo->key_parts);
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);
}
if (primary_key < MAX_KEY &&