diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-01-11 19:10:01 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-01-11 19:10:01 +0200 |
commit | 6c41a043a490d5e80dc5367d6d24d2c65064888c (patch) | |
tree | 57c3513db681501422af8f36362f8265e1eaa858 /mysql-test/t/join.test | |
parent | 42e31f7a45413b685c4332ced1d983ccfda29d25 (diff) | |
download | mariadb-git-6c41a043a490d5e80dc5367d6d24d2c65064888c.tar.gz |
BUG#25106: A USING clause in combination with a VIEW results in column
aliases ignored
When a column reference to a column in JOIN USING is resolved and a new
Item is created for this column the user defined name was lost.
This fix preserves the alias by setting the name of the new Item to the
original alias.
mysql-test/r/join.result:
BUG#25106: A USING clause in combination with a VIEW results in column
aliases ignored
- test case
mysql-test/t/join.test:
BUG#25106: A USING clause in combination with a VIEW results in column
aliases ignored
- test case
sql/sql_base.cc:
BUG#25106: A USING clause in combination with a VIEW results in column
aliases ignored
- take the alias of the Item to be replaced and set it into the newly
allocated Item.
Diffstat (limited to 'mysql-test/t/join.test')
-rw-r--r-- | mysql-test/t/join.test | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index ab85cc5bed2..99dd21e8ee2 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -591,3 +591,23 @@ select * from ((t3 natural join (t1 natural join t2)) natural join t4) drop table t1, t2, t3, t4, t5; # End of tests for WL#2486 - natural/using join + +# +# BUG#25106: A USING clause in combination with a VIEW results in column +# aliases ignored +# +CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50)); +CREATE TABLE t2 (Test_ID INTEGER); +CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1; + +CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2 + USING (Test_ID); +DESCRIBE tv1; +CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2 + ON v1.Test_ID = t2.Test_ID; +DESCRIBE tv2; + +DROP VIEW v1; +DROP TABLE t1,t2,tv1,tv2; + +--echo End of 5.0 tests. |