summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-06-20 22:30:30 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-06-20 22:30:30 +0400
commitab4a13b2b91e260d8c75a3c41b7ff5c24747cee0 (patch)
tree39626d12d01af8959bcdd846e4c5edd5f92667c2 /sql/sql_lex.cc
parent52cfa54c1d211a17a9df7c38a4568ddc4d09e6d9 (diff)
downloadmariadb-git-ab4a13b2b91e260d8c75a3c41b7ff5c24747cee0.tar.gz
Switching [EXPLAIN] UPDATE/DELETE to rely on query plan footprints.
This requires that subselect's footprints are saved before it is deleted. Attempt to save select's QPF exposes one to a variety of edge cases: - the select may be a UNION's "fake select" which has no valid id - optimization may fail in the middle (but subsequent JOIN::optimize() calls will succeed, despite the fact that there never was a query plan)
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 455ef55944d..3161dc85fb9 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4341,7 +4341,8 @@ int st_select_lex_unit::save_qpf(QPF_query *output)
if (!first->next_select())
{
/* This is a 1-way UNION, i.e. not really a UNION */
- first->save_qpf(output);
+ if (!output->get_select(first->select_number))
+ first->save_qpf(output);
return 0;
}
@@ -4371,7 +4372,8 @@ int st_select_lex_unit::save_qpf(QPF_query *output)
for (SELECT_LEX *sl= first; sl; sl= sl->next_select())
{
- sl->save_qpf(output);
+ if (!output->get_select(sl->select_number))
+ sl->save_qpf(output);
qpfu->add_select(sl->select_number);
}