summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-10-21 19:00:42 +0200
committerSergei Golubchik <serg@mariadb.org>2019-10-23 15:55:23 +0200
commit790a74d22beeadbd75dcc84dca03b3b450acd8bf (patch)
treeb5a778ac8b3d5e63c9dea27780e1c224e9b6e3ac /sql
parentae702d76438d15c84e0e113031366b0a8da47b9f (diff)
parent719ac0ad4af0dd1e20dbc94eff8f8c9f786b3393 (diff)
downloadmariadb-git-790a74d22beeadbd75dcc84dca03b3b450acd8bf.tar.gz
Merge branch 'github/5.5' into 10.1
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_subselect.cc12
-rw-r--r--sql/sql_show.cc8
2 files changed, 16 insertions, 4 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 33ac3dd7cf1..d5a906d17f0 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -2657,9 +2657,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;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index c154f5da472..d8f65c74448 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2646,8 +2646,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
- protocol->store(thd_info->query_string.str(),
- thd_info->query_string.charset());
+ if (thd_info->query_string.length())
+ protocol->store(thd_info->query_string.str(),
+ thd_info->query_string.length(),
+ thd_info->query_string.charset());
+ else
+ protocol->store_null();
if (!thd->variables.old_mode &&
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
protocol->store(thd_info->progress, 3, &store_buffer);