mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the sorting order, SQL NULL is defined to be logically inequal to anything else. (Bug #41904) rb://70 approved by Heikki Tuuri
This commit is contained in:
parent
881759bacb
commit
7a30af3eb0
1 changed files with 15 additions and 0 deletions
|
@ -442,14 +442,29 @@ row_merge_tuple_cmp(
|
|||
int cmp;
|
||||
const dfield_t* field = a;
|
||||
|
||||
/* Compare the fields of the tuples until a difference is
|
||||
found or we run out of fields to compare. If !cmp at the
|
||||
end, the tuples are equal. */
|
||||
do {
|
||||
cmp = cmp_dfield_dfield(a++, b++);
|
||||
} while (!cmp && --n_field);
|
||||
|
||||
if (UNIV_UNLIKELY(!cmp) && UNIV_LIKELY_NULL(dup)) {
|
||||
/* Report a duplicate value error if the tuples are
|
||||
logically equal. NULL columns are logically inequal,
|
||||
although they are equal in the sorting order. Find
|
||||
out if any of the fields are NULL. */
|
||||
for (b = field; b != a; b++) {
|
||||
if (dfield_is_null(b)) {
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
}
|
||||
|
||||
row_merge_dup_report(dup, field);
|
||||
}
|
||||
|
||||
func_exit:
|
||||
return(cmp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue