summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-11-11 11:41:21 +0200
committerunknown <timour@mysql.com>2005-11-11 11:41:21 +0200
commit26cce41b72270a335de889badf8e26951d7f9b8c (patch)
treef533fcf54430fc76c24585ce9e9f5cdaae74837a /mysql-test
parent5d425f936190057f727f73c8575fe5953cf56101 (diff)
parent9a0da055fd6bd662b83eacef2a60350b32ded966 (diff)
downloadmariadb-git-26cce41b72270a335de889badf8e26951d7f9b8c.tar.gz
Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into mysql.com:/home/timka/mysql/src/5.0-bug-14662
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select.result42
-rw-r--r--mysql-test/t/select.test20
2 files changed, 62 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;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index e7e6d899a66..33a3ff578f8 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2729,3 +2729,23 @@ select * from t1 where f2 >= '2005-09-3a';
select * from t1 where f2 <= '2005-09-31';
select * from t1 where f2 <= '2005-09-3a';
drop table t1;
+
+#
+# Bug ##14662 ORDER BY on column of a view, with an alias of the same
+# column causes ambiguous
+#
+
+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;
+select v1.f1 as x1, f1 from v1 order by v1.f1;
+select v2.f1 as x1, f1 from v2 order by v2.f1;
+select v3.f1 as x1, f1 from v3 order by v3.f1;
+select f1, f2, v1.f1 as x1 from v1 order by v1.f1;
+select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
+select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
+drop table t1;
+drop view v1, v2, v3;