List:Commits« Previous MessageNext Message »
From:gluh Date:December 19 2005 11:36am
Subject:bk commit into 5.0 tree (gluh:1.1992) 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.1992 05/12/19 15:36:03 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.377 05/12/19 15:35:57 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.130 05/12/19 15:35:57 gluh@stripped +19 -0
    Fix for bug#14861 aliased column names are not preserved.
      test case

  mysql-test/r/view.result
    1.141 05/12/19 15:35:57 gluh@stripped +16 -0
    Fix for bug#14861 aliased column names are not preserved.
      test case

# 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/Merge/5.0

--- 1.376/sql/sql_select.cc	Sun Dec 11 11:30:53 2005
+++ 1.377/sql/sql_select.cc	Mon Dec 19 15:35:57 2005
@@ -8189,7 +8189,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 &&
@@ -8240,10 +8240,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.140/mysql-test/r/view.result	Wed Dec  7 15:36:31 2005
+++ 1.141/mysql-test/r/view.result	Mon Dec 19 15:35:57 2005
@@ -2456,3 +2456,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.129/mysql-test/t/view.test	Wed Dec  7 13:36:24 2005
+++ 1.130/mysql-test/t/view.test	Mon Dec 19 15:35:57 2005
@@ -2319,3 +2319,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.1992) BUG#14861gluh19 Dec