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.1894 05/07/11 19:55:35 evgen@stripped +4 -0
Fix bug#11709 View was ordered by wrong column.
When searching column to sort on, item was compared to field under view
column, but not the column itself. Because names of view column and underlaid
field may differ, it leads to possibly choosing wrong column for sorting on.
This patch makes Item_direct_view_ref::eq(Item *item,...) compare
item's name with it's own name proir to comparing to *ref item.
mysql-test/r/view.result
1.85 05/07/11 19:54:57 evgen@stripped +9 -0
Test case for bug #11709 View was ordered by wrong column.
mysql-test/t/view.test
1.80 05/07/11 19:54:13 evgen@stripped +9 -0
Test case for bug #11709 View was ordered by wrong column.
sql/item.h
1.149 05/07/11 19:53:40 evgen@stripped +1 -0
Fix bug #11709 View was ordered by wrong column
sql/item.cc
1.149 05/07/11 19:51:44 evgen@stripped +6 -0
Fix bug #11709 View was ordered by wrong column
# 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
--- 1.148/sql/item.cc 2005-07-04 04:44:30 +04:00
+++ 1.149/sql/item.cc 2005-07-11 19:51:44 +04:00
@@ -4499,6 +4499,12 @@
return Item_direct_ref::fix_fields(thd, reference);
}
+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.148/sql/item.h 2005-07-04 04:50:00 +04:00
+++ 1.149/sql/item.h 2005-07-11 19:53:40 +04:00
@@ -1516,6 +1516,7 @@
:Item_direct_ref(thd, item) {}
bool fix_fields(THD *, Item **);
+ bool eq(const Item *item, bool binary_cmp) const;
};
--- 1.84/mysql-test/r/view.result 2005-07-06 19:28:55 +04:00
+++ 1.85/mysql-test/r/view.result 2005-07-11 19:54:57 +04:00
@@ -1940,3 +1940,12 @@
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;
--- 1.79/mysql-test/t/view.test 2005-07-06 19:28:29 +04:00
+++ 1.80/mysql-test/t/view.test 2005-07-11 19:54:13 +04:00
@@ -1778,3 +1778,12 @@
DROP PROCEDURE p1;
DROP VIEW v1;
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;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1894) BUG#11709 | eugene | 11 Jul |