Commit 2dfa4555 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

row0ins.c:

  Allow equal key values in a unique secondary index if the key value contains an SQL NULL
parent c3a881a6
...@@ -319,6 +319,7 @@ row_ins_dupl_error_with_rec( ...@@ -319,6 +319,7 @@ row_ins_dupl_error_with_rec(
ulint matched_fields; ulint matched_fields;
ulint matched_bytes; ulint matched_bytes;
ulint n_unique; ulint n_unique;
ulint i;
n_unique = dict_index_get_n_unique(index); n_unique = dict_index_get_n_unique(index);
...@@ -329,12 +330,26 @@ row_ins_dupl_error_with_rec( ...@@ -329,12 +330,26 @@ row_ins_dupl_error_with_rec(
if (matched_fields < n_unique) { if (matched_fields < n_unique) {
return(FALSE); return(FALSE);
}
/* In a unique secondary index we allow equal key values if they
contain SQL NULLs */
if (!(index->type & DICT_CLUSTERED)) {
for (i = 0; i < n_unique; i++) {
if (UNIV_SQL_NULL == dfield_get_len(
dtuple_get_nth_field(entry, i))) {
return(FALSE);
}
}
} }
if (!rec_get_deleted_flag(rec)) { if (!rec_get_deleted_flag(rec)) {
return(TRUE); return(TRUE);
} }
return(FALSE); return(FALSE);
......
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