List:Internals« Previous MessageNext Message »
From:eugene Date:July 12 2005 7:24pm
Subject:bk commit into 5.0 tree (evgen:1.1916)
View as plain text  
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.1916 05/07/12 23:24:35 evgen@stripped +4 -0
  Merge

  mysql-test/t/view.test
    1.82 05/07/12 23:24:34 evgen@stripped +0 -0
    SCCS merged

  mysql-test/r/view.result
    1.87 05/07/12 23:24:34 evgen@stripped +0 -0
    SCCS merged

  sql/item.h
    1.150 05/07/12 23:22:40 evgen@stripped +0 -0
    Auto merged

  sql/item.cc
    1.150 05/07/12 23:22:40 evgen@stripped +0 -0
    Auto merged

# 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-11709/RESYNC

--- 1.149/sql/item.cc	2005-07-12 21:08:52 +04:00
+++ 1.150/sql/item.cc	2005-07-12 23:22:40 +04:00
@@ -4499,6 +4499,35 @@
   return Item_direct_ref::fix_fields(thd, reference);
 }
 
+/*
+  Compare view field's name with item's name before call to referenced
+  item's eq()
+
+  SYNOPSIS
+    Item_direct_view_ref::eq()
+    item        item to compare with
+    binary_cmp  make binary comparison
+
+  DESCRIPTION
+    Consider queries:
+    create view v1 as select t1.f1 as f2, t1.f2 as f1 from t1;
+    select * from v1 order by f1;
+    In order to choose right field for sorting we need to compare
+    given item's name (f1) to view field's name prior to calling
+    referenced item's eq().
+
+  RETURN
+    TRUE    Referenced item is equal to given item
+    FALSE   otherwise
+*/
+
+
+bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
+{
+  Item *it= ((Item *) item)->real_item();
+  return (!it->name || !my_strcasecmp(system_charset_info, it->name,
+          field_name)) && ref && (*ref)->real_item()->eq(it, binary_cmp);
+}
 
 void Item_null_helper::print(String *str)
 {

--- 1.149/sql/item.h	2005-07-12 15:59:42 +04:00
+++ 1.150/sql/item.h	2005-07-12 23:22:40 +04:00
@@ -1524,6 +1524,7 @@
     :Item_direct_ref(thd, item) {}
 
   bool fix_fields(THD *, Item **);
+  bool eq(const Item *item, bool binary_cmp) const;
 };
 
 

--- 1.86/mysql-test/r/view.result	2005-07-12 18:26:16 +04:00
+++ 1.87/mysql-test/r/view.result	2005-07-12 23:24:34 +04:00
@@ -1948,6 +1948,15 @@
 DROP PROCEDURE p1;
 DROP VIEW v1;
 DROP TABLE t1;
+create table t1 (f1 int, f2 int);
+create view v1 as select f1 as f3, f2 as f1 from t1;
+insert into t1 values (1,3),(2,1),(3,2);
+select * from v1 order by f1;
+f3	f1
+2	1
+3	2
+1	3
+drop table t1;
 CREATE TABLE t1 (f1 char) ENGINE = innodb;
 INSERT INTO t1 VALUES ('A');
 CREATE VIEW  v1 AS SELECT * FROM t1;

--- 1.81/mysql-test/t/view.test	2005-07-12 18:26:16 +04:00
+++ 1.82/mysql-test/t/view.test	2005-07-12 23:24:34 +04:00
@@ -1790,6 +1790,15 @@
 DROP TABLE t1;
 
 #
+# Test for bug #11709 View was ordered by wrong column
+#
+create table t1 (f1 int, f2 int);
+create view v1 as select f1 as f3, f2 as f1 from t1;
+insert into t1 values (1,3),(2,1),(3,2);
+select * from v1 order by f1;
+drop table t1;
+
+#
 # Test for bug #11771: wrong query_id in SELECT * FROM <view>
 #
 
Thread
bk commit into 5.0 tree (evgen:1.1916)eugene12 Jul