diff options
author | gkodinov/kgeorge@macbook.gmz <> | 2006-11-09 16:55:42 +0200 |
---|---|---|
committer | gkodinov/kgeorge@macbook.gmz <> | 2006-11-09 16:55:42 +0200 |
commit | e7ff881c6bd23defd7d611a18a0a18bd58084055 (patch) | |
tree | 5dedc2a9ee9c23a4508bde184e3af51a70b25f7b /sql/item.cc | |
parent | edf194ab1f0e32edcb5606b0ac7037e94ef1fb96 (diff) | |
download | mariadb-git-e7ff881c6bd23defd7d611a18a0a18bd58084055.tar.gz |
Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
When compiling GROUP BY Item_ref instances are dereferenced in
setup_copy_fields(), i.e. replaced with the corresponding Item_field
(if they point to one) or Item_copy_string for the other cases.
Since the Item_ref (in the Item_field case) is no longer used the information
about the aliases stored in it is lost.
Fixed by preserving the column, table and DB alias on dereferencing Item_ref
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index dc92edd651d..76f0332b4ab 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4202,6 +4202,10 @@ void Item_field::make_field(Send_field *tmp_field) DBUG_ASSERT(tmp_field->table_name != 0); if (name) tmp_field->col_name=name; // Use user supplied name + if (table_name) + tmp_field->table_name= table_name; + if (db_name) + tmp_field->db_name= db_name; } |