mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
row0mysql.c:
Remove erroneous warning of a duplicate key when the key in a UNIQUE secondary index contains a NULL innobase/row/row0mysql.c: Remove erroneous warning of a duplicate key when the key in a UNIQUE secondary index contains a NULL
This commit is contained in:
@ -1678,6 +1678,8 @@ row_scan_and_check_index(
|
|||||||
rec_t* rec;
|
rec_t* rec;
|
||||||
ibool is_ok = TRUE;
|
ibool is_ok = TRUE;
|
||||||
int cmp;
|
int cmp;
|
||||||
|
ibool contains_null;
|
||||||
|
ulint i;
|
||||||
char err_buf[1000];
|
char err_buf[1000];
|
||||||
|
|
||||||
*n_rows = 0;
|
*n_rows = 0;
|
||||||
@ -1723,6 +1725,21 @@ loop:
|
|||||||
cmp = cmp_dtuple_rec_with_match(prev_entry, rec,
|
cmp = cmp_dtuple_rec_with_match(prev_entry, rec,
|
||||||
&matched_fields,
|
&matched_fields,
|
||||||
&matched_bytes);
|
&matched_bytes);
|
||||||
|
contains_null = FALSE;
|
||||||
|
|
||||||
|
/* In a unique secondary index we allow equal key values if
|
||||||
|
they contain SQL NULLs */
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < dict_index_get_n_ordering_defined_by_user(index);
|
||||||
|
i++) {
|
||||||
|
if (UNIV_SQL_NULL == dfield_get_len(
|
||||||
|
dtuple_get_nth_field(prev_entry, i))) {
|
||||||
|
|
||||||
|
contains_null = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cmp > 0) {
|
if (cmp > 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: index records in a wrong order in index %s\n",
|
"Error: index records in a wrong order in index %s\n",
|
||||||
@ -1736,6 +1753,7 @@ loop:
|
|||||||
|
|
||||||
is_ok = FALSE;
|
is_ok = FALSE;
|
||||||
} else if ((index->type & DICT_UNIQUE)
|
} else if ((index->type & DICT_UNIQUE)
|
||||||
|
&& !contains_null
|
||||||
&& matched_fields >=
|
&& matched_fields >=
|
||||||
dict_index_get_n_ordering_defined_by_user(index)) {
|
dict_index_get_n_ordering_defined_by_user(index)) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user