summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/item.h4
-rw-r--r--sql/table.cc4
2 files changed, 5 insertions, 3 deletions
diff --git a/sql/item.h b/sql/item.h
index 7795ff9fa1b..88f7d2d67f0 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2644,7 +2644,7 @@ public:
bool any_privileges);
bool check_vcol_func_processor(void *arg)
{
- if (table_name)
+ if (alias_name_used)
{
/*
NOTE: alias is different in every statement, we must update it.
@@ -2865,7 +2865,7 @@ public:
bool check_table_name_processor(void *arg)
{
Check_table_name_prm &p= *(Check_table_name_prm *) arg;
- if (!field && p.table_name.length && table_name)
+ if (p.table_name.length && table_name)
{
DBUG_ASSERT(p.db.length);
if ((db_name &&
diff --git a/sql/table.cc b/sql/table.cc
index 68d28a5efea..11ec0ef96b6 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3230,6 +3230,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
goto err;
outparam->alias.set(tmp_alias, tmp_length, table_alias_charset);
+ outparam->alias_name_used= my_strcasecmp(table_alias_charset,
+ share->table_name.str, alias);
outparam->quick_keys.init();
outparam->covering_keys.init();
outparam->intersect_keys.init();
@@ -4781,7 +4783,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
{
DBUG_ASSERT(s->tmp_table != NO_TMP_TABLE || s->tdc->ref_count > 0);
- if (thd->lex->need_correct_ident())
+// if (thd->lex->need_correct_ident())
alias_name_used= my_strcasecmp(table_alias_charset,
s->table_name.str,
tl->alias);