summaryrefslogtreecommitdiff
path: root/mysql-test/r/select.result
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-11-11 11:40:35 +0200
committerunknown <timour@mysql.com>2005-11-11 11:40:35 +0200
commitaa54d4036c3fd02f0f01883eaef28a8942ed7f88 (patch)
tree5a4096f282af46eb0f4d8d92a8fbf8bf087a9743 /mysql-test/r/select.result
parent26320ebe2f1c56d3376a94a60291c95c0cf0658d (diff)
downloadmariadb-git-aa54d4036c3fd02f0f01883eaef28a8942ed7f88.tar.gz
Fix for BUG#14662: view column in ORDER BY considered ambiguous if SELECT contains
the same column as an aliased and as a non-aliased column. The problem was that Item_direct_view_ref::eq() was first comparing view columns by name, and in this case the name of one of them is different since it is aliased. mysql-test/r/select.result: Added test for BUG#14662. mysql-test/t/select.test: Added test for BUG#14662. sql/item.cc: Changed the way view column refenreces are compared. Two view columns are equal if they resolve to the same result field of a view.
Diffstat (limited to 'mysql-test/r/select.result')
-rw-r--r--mysql-test/r/select.result42
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 318cf8e7b65..8a126b7ddfb 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3241,3 +3241,45 @@ f1 f2
Warnings:
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
drop table t1;
+create table t1 (f1 int, f2 int);
+insert into t1 values (1, 30), (2, 20), (3, 10);
+create algorithm=merge view v1 as select f1, f2 from t1;
+create algorithm=merge view v2 (f2, f1) as select f1, f2 from t1;
+create algorithm=merge view v3 as select t1.f1 as f2, t1.f2 as f1 from t1;
+select t1.f1 as x1, f1 from t1 order by t1.f1;
+x1 f1
+1 1
+2 2
+3 3
+select v1.f1 as x1, f1 from v1 order by v1.f1;
+x1 f1
+1 1
+2 2
+3 3
+select v2.f1 as x1, f1 from v2 order by v2.f1;
+x1 f1
+10 10
+20 20
+30 30
+select v3.f1 as x1, f1 from v3 order by v3.f1;
+x1 f1
+10 10
+20 20
+30 30
+select f1, f2, v1.f1 as x1 from v1 order by v1.f1;
+f1 f2 x1
+1 30 1
+2 20 2
+3 10 3
+select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
+f1 f2 x1
+10 3 10
+20 2 20
+30 1 30
+select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
+f1 f2 x1
+10 3 10
+20 2 20
+30 1 30
+drop table t1;
+drop view v1, v2, v3;