summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-06-28 11:38:26 -0700
committerIgor Babaev <igor@askmonty.org>2017-06-28 11:39:33 -0700
commite60802394743d990e71754716c5f3cc234f581c1 (patch)
tree9a14ce5fd68344cdba51e38bb54bc6f13212b45d /sql/sql_show.cc
parent31ba0fa48d27715e82258b1e74401093e0ee17a2 (diff)
downloadmariadb-git-e60802394743d990e71754716c5f3cc234f581c1.tar.gz
Fixed the bug mdev-13107 and some similar unreported bugs.
The problems were in the code of sql_show.cc. There the tables could be opened in such a way that mysql_derived_init() never worked for CTE tables. As a result they were not marked as derived and mysql_handle_derived() were not called for derived tables used in their specifications.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index bfeac981a93..1bc2321c1ca 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1163,7 +1163,7 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
bool open_error=
open_tables(thd, &table_list, &counter,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) ||
- mysql_handle_derived(thd->lex, DT_PREPARE);
+ mysql_handle_derived(thd->lex, DT_INIT | DT_PREPARE);
thd->pop_internal_handler();
if (open_error && (thd->killed || thd->is_error()))
goto exit;
@@ -1416,7 +1416,7 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
if (open_normal_and_derived_tables(thd, table_list,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL,
- DT_PREPARE | DT_CREATE))
+ DT_INIT | DT_PREPARE | DT_CREATE))
DBUG_VOID_RETURN;
table= table_list->table;
@@ -4274,7 +4274,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
(can_deadlock ?
MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)),
- DT_PREPARE | DT_CREATE));
+ DT_INIT | DT_PREPARE | DT_CREATE));
/*
Restore old value of sql_command back as it is being looked at in
process_table() function.