summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-09-09 16:29:50 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-09-18 16:08:13 +0200
commitda3ec3d421c345bbd4b6ddfe0e1e08ed192c0a97 (patch)
tree4f58cdc627a84c78c4be8c6de5ae4f69092c4e85 /sql/sql_explain.cc
parent79140b03839a6b46a92736bd2ce03cefd43a5058 (diff)
downloadmariadb-git-da3ec3d421c345bbd4b6ddfe0e1e08ed192c0a97.tar.gz
MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
Printing non-trivial HAVING added.
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 15ee67a0318..1d804b15390 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -862,7 +862,20 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->add_member("const_condition");
write_item(writer, exec_const_cond);
}
-
+ /* we do not print HAVING which always evaluates to TRUE */
+ if (having || (having_value == Item::COND_FALSE))
+ {
+ writer->add_member("having_condition");
+ if (likely(having))
+ write_item(writer, having);
+ else
+ {
+ /* Normally we should not go this branch, left just for safety */
+ DBUG_ASSERT(having_value == Item::COND_FALSE);
+ writer->add_str("0");
+ }
+ }
+
Filesort_tracker *first_table_sort= NULL;
bool first_table_sort_used= false;
int started_objects= 0;