summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-30 20:15:38 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-05 17:15:59 +0200
commit0559f12972dba6a141de553aacd724b2bcfaf71d (patch)
treecdb26c8aa8a32f9adc9afcd1ee60dc1de4cbf389 /sql/item.cc
parent186075adf285725be1c8ca6f668addccf76b4f95 (diff)
downloadmariadb-git-0559f12972dba6a141de553aacd724b2bcfaf71d.tar.gz
MDEV-13209 Cross-database operation with virtual columns fails
if we don't need to print field's table name, we surely don't need to print field's db name either
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 12935a43bea..adc1c1b9d46 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2669,22 +2669,21 @@ void Item_ident::print(String *str, enum_query_type query_type)
use_db_name= !(cached_table && cached_table->belong_to_view &&
cached_table->belong_to_view->compact_view_format);
- if (!use_db_name && use_table_name &&
- (query_type & QT_ITEM_IDENT_SKIP_TABLE_NAMES))
+ if (use_table_name && (query_type & QT_ITEM_IDENT_SKIP_TABLE_NAMES))
{
/*
Don't print the table name if it's the only table in the context
XXX technically, that's a sufficient, but too strong condition
*/
if (!context)
- use_table_name= false;
+ use_db_name= use_table_name= false;
else if (context->outer_context)
use_table_name= true;
else if (context->last_name_resolution_table == context->first_name_resolution_table)
- use_table_name= false;
+ use_db_name= use_table_name= false;
else if (!context->last_name_resolution_table &&
!context->first_name_resolution_table->next_name_resolution_table)
- use_table_name= false;
+ use_db_name= use_table_name= false;
}
if (!field_name || !field_name[0])