summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-06-30 18:11:35 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-06-30 18:29:02 +0530
commitcc0dca366357651ddb549e31a12b1ecd39c7380e (patch)
tree863f06ec7ba49576f70079b475c1e9ae1a6e73aa /sql/opt_range.cc
parent8e8f9671cbef43ef347e2c942de074278847241f (diff)
downloadmariadb-git-cc0dca366357651ddb549e31a12b1ecd39c7380e.tar.gz
MDEV-22910: SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name (on optimized builds)
Make sure to initialize members of TABLE::reginfo when TABLE::init is called. In this case the problem was that table->reginfo.join_tab was set for the SELECT query and then was reused by the UPDATE query. This case occurred only when the SELECT query had a degenerate join.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ecbf5d6afcb..86935f3ef27 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2690,10 +2690,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
DBUG_PRINT("info",("Time to scan table: %g", read_time));
Json_writer_object table_records(thd);
- if (head->reginfo.join_tab)
- table_records.add_table_name(head->reginfo.join_tab);
- else
- table_records.add_table_name(head);
+ table_records.add_table_name(head);
+
Json_writer_object trace_range(thd, "range_analysis");
{
Json_writer_object table_rec(thd, "table_scan");