diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-25 12:57:36 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-25 12:57:36 +0300 |
commit | 19ceaf2928bbd562e3fd5eabecd8ca69fdf062b6 (patch) | |
tree | 88c378a716b01193fedcbac207908a34e465f3c8 /sql/opt_subselect.cc | |
parent | 7457181ba43870ca9a619d74b7614b868f0a7511 (diff) | |
parent | 790a74d22beeadbd75dcc84dca03b3b450acd8bf (diff) | |
download | mariadb-git-19ceaf2928bbd562e3fd5eabecd8ca69fdf062b6.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 1d3ebba4f4e..2fb5b88687f 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2647,9 +2647,17 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables) { do /* For all equalities on all key parts */ { - /* Check if this is "t.keypart = expr(outer_tables) */ + /* + Check if this is "t.keypart = expr(outer_tables) + + Don't allow variants that can produce duplicates: + - Dont allow "ref or null" + - the keyuse (that is, the operation) must be null-rejecting, + unless the other expression is non-NULLable. + */ if (!(keyuse->used_tables & sj_inner_tables) && - !(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL)) + !(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) && + (keyuse->null_rejecting || !keyuse->val->maybe_null)) { bound_parts |= 1 << keyuse->keypart; } |