mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge 10.3 into 10.4
This commit is contained in:
@ -10678,6 +10678,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
|
||||
uchar *key_buff=j->ref.key_buff, *null_ref_key= 0;
|
||||
uint null_ref_part= NO_REF_PART;
|
||||
bool keyuse_uses_no_tables= TRUE;
|
||||
uint not_null_keyparts= 0;
|
||||
if (ftkey)
|
||||
{
|
||||
j->ref.items[0]=((Item_func*)(keyuse->val))->key_item();
|
||||
@ -10707,6 +10708,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
|
||||
j->ref.items[i]=keyuse->val; // Save for cond removal
|
||||
j->ref.cond_guards[i]= keyuse->cond_guard;
|
||||
|
||||
if (!keyuse->val->maybe_null || keyuse->null_rejecting)
|
||||
not_null_keyparts++;
|
||||
/*
|
||||
Set ref.null_rejecting to true only if we are going to inject a
|
||||
"keyuse->val IS NOT NULL" predicate.
|
||||
@ -10766,12 +10769,18 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
|
||||
ulong key_flags= j->table->actual_key_flags(keyinfo);
|
||||
if (j->type == JT_CONST)
|
||||
j->table->const_table= 1;
|
||||
else if (!((keyparts == keyinfo->user_defined_key_parts &&
|
||||
((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) ||
|
||||
(keyparts > keyinfo->user_defined_key_parts && // true only for extended keys
|
||||
MY_TEST(key_flags & HA_EXT_NOSAME) &&
|
||||
keyparts == keyinfo->ext_key_parts)) ||
|
||||
null_ref_key)
|
||||
else if (!((keyparts == keyinfo->user_defined_key_parts &&
|
||||
(
|
||||
(key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME ||
|
||||
/* Unique key and all keyparts are NULL rejecting */
|
||||
((key_flags & HA_NOSAME) && keyparts == not_null_keyparts)
|
||||
)) ||
|
||||
/* true only for extended keys */
|
||||
(keyparts > keyinfo->user_defined_key_parts &&
|
||||
MY_TEST(key_flags & HA_EXT_NOSAME) &&
|
||||
keyparts == keyinfo->ext_key_parts)
|
||||
) ||
|
||||
null_ref_key)
|
||||
{
|
||||
/* Must read with repeat */
|
||||
j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF;
|
||||
|
Reference in New Issue
Block a user