summaryrefslogtreecommitdiff
path: root/mysql-test/t/metadata.test
diff options
context:
space:
mode:
authorgkodinov/kgeorge@macbook.gmz <>2006-11-09 16:55:42 +0200
committergkodinov/kgeorge@macbook.gmz <>2006-11-09 16:55:42 +0200
commite7ff881c6bd23defd7d611a18a0a18bd58084055 (patch)
tree5dedc2a9ee9c23a4508bde184e3af51a70b25f7b /mysql-test/t/metadata.test
parentedf194ab1f0e32edcb5606b0ac7037e94ef1fb96 (diff)
downloadmariadb-git-e7ff881c6bd23defd7d611a18a0a18bd58084055.tar.gz
Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
When compiling GROUP BY Item_ref instances are dereferenced in setup_copy_fields(), i.e. replaced with the corresponding Item_field (if they point to one) or Item_copy_string for the other cases. Since the Item_ref (in the Item_field case) is no longer used the information about the aliases stored in it is lost. Fixed by preserving the column, table and DB alias on dereferencing Item_ref
Diffstat (limited to 'mysql-test/t/metadata.test')
-rw-r--r--mysql-test/t/metadata.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index 65338448555..a6ebfdc14c1 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -61,4 +61,23 @@ drop table t1;//
delimiter ;//
--disable_info
+#
+# Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
+#
+--enable_metadata
+create table t1 (id int(10));
+insert into t1 values (1);
+CREATE VIEW v1 AS select t1.id as id from t1;
+CREATE VIEW v2 AS select t1.id as renamed from t1;
+CREATE VIEW v3 AS select t1.id + 12 as renamed from t1;
+select * from v1 group by id limit 1;
+select * from v1 group by id limit 0;
+select * from v1 where id=1000 group by id;
+select * from v1 where id=1 group by id;
+select * from v2 where renamed=1 group by renamed;
+select * from v3 where renamed=1 group by renamed;
+drop table t1;
+drop view v1,v2,v3;
+--disable_metadata
+
# End of 4.1 tests