summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-11-24 21:33:50 +0100
committerSergei Golubchik <serg@mariadb.org>2020-11-25 22:19:59 +0100
commitf3b10354a97a0815d36abbfd25a5f10489a3eaab (patch)
treeba05bcba35566134ab4755901c301736c5c8647e /sql/sql_show.cc
parent00f54b56b1eca3e4daf737107dd9097d9634f9ac (diff)
downloadmariadb-git-f3b10354a97a0815d36abbfd25a5f10489a3eaab.tar.gz
MDEV-24230 subquery on information_schema fails with error message
disable thd->count_cuted_fields when populating internal temporary tables for I_S, because this is how SELECT works standalone. And if the SELECT is a part of INSERT or UPDATE or RETURN or SET or anything else that enables thd->count_cuted_fields, this counting should only apply when storing the result of the SELECT in a field or a variable, not when populating internal temporary tables for I_S.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc10
1 files changed, 1 insertions, 9 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 8f21d2009a6..909963f5f7a 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3695,7 +3695,6 @@ static bool show_status_array(THD *thd, const char *wild,
char name_buffer[NAME_CHAR_LEN];
int len;
SHOW_VAR tmp, *var;
- Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
bool res= FALSE;
CHARSET_INFO *charset= system_charset_info;
DBUG_ENTER("show_status_array");
@@ -8669,13 +8668,6 @@ static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
DBUG_ASSERT(table->s->keys == 0);
DBUG_ASSERT(table->s->uniques == 0);
- // XXX HACK HACK HACK: in a stored function, RETURN (SELECT ...)
- // enables warnings (in THD::sp_eval_expr) for the whole val_xxx/store pair,
- // while the intention is to warn only for store(). Until this is
- // fixed let's avoid data truncation warnings in I_S->fill_table()
- if (thd->count_cuted_fields == CHECK_FIELD_IGNORE)
- {
-
uchar *cur= table->field[0]->ptr;
/* first recinfo could be a NULL bitmap, not an actual Field */
from_recinfo= to_recinfo= p->start_recinfo + (cur != table->record[0]);
@@ -8709,7 +8701,6 @@ static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
to_recinfo++;
}
p->recinfo= to_recinfo;
- } // XXX end of HACK HACK HACK
// TODO switch from Aria to Memory if all blobs were optimized away?
if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo,
@@ -8872,6 +8863,7 @@ bool get_schema_tables_result(JOIN *join,
}
Switch_to_definer_security_ctx backup_ctx(thd, table_list);
+ Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
if (table_list->schema_table->fill_table(thd, table_list, cond))
{
result= 1;