summaryrefslogtreecommitdiff
path: root/innobase/dict/dict0dict.c
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2004-09-16 20:50:24 +0300
committerheikki@hundin.mysql.fi <>2004-09-16 20:50:24 +0300
commit6083e00d7381ddbcdeadc39a5acff5017439c188 (patch)
tree4af62c5047a3c9d07dd0bae6236b6e6677cb207c /innobase/dict/dict0dict.c
parent78fa3aeff4ee40212ccc28d87aa8031fb1773bdf (diff)
downloadmariadb-git-6083e00d7381ddbcdeadc39a5acff5017439c188.tar.gz
dict0dict.h, dict0dict.c, row0row.c, pars0opt.c:
Fix bug #5180: having a column prefix index in the primary key, and the same column fully in a secondary key could cause an assertion failure in row_build_row_ref()
Diffstat (limited to 'innobase/dict/dict0dict.c')
-rw-r--r--innobase/dict/dict0dict.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index bd07c5abffe..61bf3fae137 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -526,8 +526,10 @@ dict_index_contains_col_or_prefix(
}
/************************************************************************
-Looks for a matching field in an index. The column and the prefix len have
-to be the same. */
+Looks for a matching field in an index. The column has to be the same. The
+column in index must be complete, or must contain a prefix longer than the
+column in index2. That is, we must be able to construct the prefix in index2
+from the prefix in index. */
ulint
dict_index_get_nth_field_pos(
@@ -555,7 +557,9 @@ dict_index_get_nth_field_pos(
field = dict_index_get_nth_field(index, pos);
if (field->col == field2->col
- && field->prefix_len == field2->prefix_len) {
+ && (field->prefix_len == 0
+ || (field->prefix_len >= field2->prefix_len
+ && field2->prefix_len != 0))) {
return(pos);
}