summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <gluh@eagle.(none)>2007-01-12 14:48:59 +0400
committerunknown <gluh@eagle.(none)>2007-01-12 14:48:59 +0400
commit5a80954670ef5bc89e0150b05f38d6c3a292e914 (patch)
tree7ceeafeb98f892ac7ca095140d09cf5699606bf5 /sql/sql_base.cc
parentcf76bb5118f65394228102579e7ba6fa039cad85 (diff)
parent7f9da471cd5f0b2b04242c4905aa45b049de59dc (diff)
downloadmariadb-git-5a80954670ef5bc89e0150b05f38d6c3a292e914.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt mysql-test/r/order_by.result: Auto merged mysql-test/t/order_by.test: Auto merged sql/item.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_base.cc: Auto merged mysql-test/r/join.result: manual merge mysql-test/t/join.test: manual merge
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 8303ef54c23..75e019ccb63 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3801,6 +3801,19 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
column reference. See create_view_field() for details.
*/
item= nj_col->create_item(thd);
+ /*
+ *ref != NULL means that *ref contains the item that we need to
+ replace. If the item was aliased by the user, set the alias to
+ the replacing item.
+ We need to set alias on both ref itself and on ref real item.
+ */
+ if (*ref && !(*ref)->is_autogenerated_name)
+ {
+ item->set_name((*ref)->name, (*ref)->name_length,
+ system_charset_info);
+ item->real_item()->set_name((*ref)->name, (*ref)->name_length,
+ system_charset_info);
+ }
if (register_tree_change && arena)
thd->restore_active_arena(arena, &backup);