From: Date: July 4 2005 10:20pm Subject: bk commit into 5.0 tree (evgen:1.1877) BUG#11399 List-Archive: http://lists.mysql.com/internals/26647 X-Bug: 11399 Message-Id: <20050704202056.AA57213E661@localhost.moonbone.local> Below is the list of changes that have just been committed into a local 5.0 repository of evgen. When evgen does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1877 05/07/05 00:20:52 evgen@stripped +3 -0 Fix bug #11399 Use an alias in a select statement on a view Column alias was lost during view preraration. mysql-test/r/view.result 1.91 05/07/04 23:55:23 evgen@stripped +8 -0 Test case for bug#11399 Use an alias in a select statement on a view mysql-test/t/view.test 1.77 05/07/04 23:54:49 evgen@stripped +10 -0 Test case for bug#11399 Use an alias in a select statement on a view sql/sql_base.cc 1.264 05/07/04 23:52:25 evgen@stripped +8 -5 Fix bug#11399 Use an alias in a select statement on a view # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: evgen # Host: moonbone.local # Root: /work/mysql-5.0-bug-11399 --- 1.263/sql/sql_base.cc 2005-07-04 04:24:21 +04:00 +++ 1.264/sql/sql_base.cc 2005-07-04 23:52:25 +04:00 @@ -2447,11 +2447,6 @@ { if (!my_strcasecmp(system_charset_info, field_it.name(), name)) { - Item *item= field_it.create_item(thd); - if (!item) - { - DBUG_RETURN(0); - } if (table_list->schema_table_reformed) { /* @@ -2470,6 +2465,14 @@ name, length)) DBUG_RETURN(WRONG_GRANT); #endif + Item *item= field_it.create_item(thd); + if (!item) + { + DBUG_RETURN(0); + } + if (*ref && !(*ref)->is_autogenerated_name) + item->set_name((*ref)->name, (*ref)->name_length, + system_charset_info); if (register_tree_change) thd->change_item_tree(ref, item); else --- 1.90/mysql-test/r/view.result 2005-07-02 14:16:26 +04:00 +++ 1.91/mysql-test/r/view.result 2005-07-04 23:55:23 +04:00 @@ -1863,3 +1863,11 @@ set sql_mode=default; drop view v2,v1; drop table t1; +create table t1 (f1 int); +insert into t1 values (1); +create view v1 as select f1 from t1; +select f1 as alias from v1; +alias +1 +drop view v1; +drop table t1; --- 1.76/mysql-test/t/view.test 2005-07-01 08:05:34 +04:00 +++ 1.77/mysql-test/t/view.test 2005-07-04 23:54:49 +04:00 @@ -1714,3 +1714,13 @@ set sql_mode=default; drop view v2,v1; drop table t1; + +# +# Bug#11399 Use an alias in a select statement on a view +# +create table t1 (f1 int); +insert into t1 values (1); +create view v1 as select f1 from t1; +select f1 as alias from v1; +drop view v1; +drop table t1;