diff options
author | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2005-12-19 15:36:03 +0400 |
---|---|---|
committer | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2005-12-19 15:36:03 +0400 |
commit | c7a440d1c6d0158a43880745971d20d95bcf6803 (patch) | |
tree | 6f48ac02b3b41e5fc0e2afe3f976b0659bba0c03 /mysql-test | |
parent | 479a02fad565dbe2ef875f949e8306f8fde3e41f (diff) | |
download | mariadb-git-c7a440d1c6d0158a43880745971d20d95bcf6803.tar.gz |
Fix for bug#14861 aliased column names are not preserved.
Create tmp table filed using original item name when it's necessary
mysql-test/r/view.result:
Fix for bug#14861 aliased column names are not preserved.
test case
mysql-test/t/view.test:
Fix for bug#14861 aliased column names are not preserved.
test case
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/view.result | 16 | ||||
-rw-r--r-- | mysql-test/t/view.test | 19 |
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index e4f2671eb34..7e7d0617b51 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -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; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6d2afb908a4..718e1a9932b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -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; |