List:Internals« Previous MessageNext Message »
From:gluh Date:December 5 2005 11:51am
Subject:bk commit into 5.0 tree (gluh:1.1974) BUG#14861
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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.1974 05/12/05 14:51:13 gluh@stripped +3 -0
  Fix for bug#14861 aliased column names are not preserved.
    Create tmp table filed using original item name when it's necessary

  sql/sql_select.cc
    1.380 05/12/05 14:49:38 gluh@stripped +7 -5
    Fix for bug#14861 aliased column names are not preserved.
      Create tmp table filed using original item name when it's necessary

  mysql-test/t/view.test
    1.129 05/12/05 14:49:38 gluh@stripped +19 -0
    Fix for bug#14861 aliased column names are not preserved.
      test case

  mysql-test/r/view.result
    1.139 05/12/05 14:49:38 gluh@stripped +16 -0
    Fix for bug#14861 aliased column names are not preserved.
      test result

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.0.14861

--- 1.379/sql/sql_select.cc	Thu Dec  1 11:14:00 2005
+++ 1.380/sql/sql_select.cc	Mon Dec  5 14:49:38 2005
@@ -8175,7 +8175,7 @@ Field *create_tmp_field(THD *thd, TABLE 
                         uint convert_blob_length)
 {
   Item::Type orig_type= type;
-  Item *orig_item;
+  Item *orig_item= 0;
 
   if (type != Item::FIELD_ITEM &&
       item->real_item()->type() == Item::FIELD_ITEM &&
@@ -8226,10 +8226,12 @@ Field *create_tmp_field(THD *thd, TABLE 
     }
     else
       result= create_tmp_field_from_field(thd, (*from_field= field->field),
-                                       item->name, table,
-                                       modify_item ? field :
-                                       NULL,
-                                       convert_blob_length);
+                                          orig_item ? orig_item->name :
+                                          item->name,
+                                          table,
+                                          modify_item ? field :
+                                          NULL,
+                                          convert_blob_length);
     if (orig_type == Item::REF_ITEM && orig_modify)
       ((Item_ref*)orig_item)->set_result_field(result);
     return result;

--- 1.138/mysql-test/r/view.result	Fri Dec  2 23:20:22 2005
+++ 1.139/mysql-test/r/view.result	Mon Dec  5 14:49:38 2005
@@ -2451,3 +2451,19 @@ f1()
 42
 drop view v2,v1;
 drop function f1;
+create table t1 (id numeric, warehouse_id numeric);
+create view v1 as select id from t1;
+create view v2 as
+select t1.warehouse_id, v1.id as receipt_id
+from t1, v1 where t1.id = v1.id;
+insert into t1 (id, warehouse_id) values(3, 2);
+insert into t1 (id, warehouse_id) values(4, 2);
+insert into t1 (id, warehouse_id) values(5, 1);
+select v2.receipt_id as alias1, v2.receipt_id as alias2 from v2
+order by v2.receipt_id;
+alias1	alias2
+3	3
+4	4
+5	5
+drop view v2, v1;
+drop table t1;

--- 1.128/mysql-test/t/view.test	Fri Dec  2 23:20:22 2005
+++ 1.129/mysql-test/t/view.test	Mon Dec  5 14:49:38 2005
@@ -2320,3 +2320,22 @@ CREATE VIEW v2 AS SELECT f1();
 select * from v2;
 drop view v2,v1;
 drop function f1;
+
+#
+# Bug#14861: aliased column names are not preserved.
+#
+create table t1 (id numeric, warehouse_id numeric);
+create view v1 as select id from t1;
+create view v2 as
+select t1.warehouse_id, v1.id as receipt_id
+from t1, v1 where t1.id = v1.id;
+
+insert into t1 (id, warehouse_id) values(3, 2);
+insert into t1 (id, warehouse_id) values(4, 2);
+insert into t1 (id, warehouse_id) values(5, 1);
+
+select v2.receipt_id as alias1, v2.receipt_id as alias2 from v2
+order by v2.receipt_id;
+
+drop view v2, v1;
+drop table t1;
Thread
bk commit into 5.0 tree (gluh:1.1974) BUG#14861gluh5 Dec