summaryrefslogtreecommitdiff
path: root/mysql-test/r/metadata.result
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2006-11-09 16:55:42 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2006-11-09 16:55:42 +0200
commit59b45b5b0ab0bfe470919ba5175e79307928cd79 (patch)
tree5dedc2a9ee9c23a4508bde184e3af51a70b25f7b /mysql-test/r/metadata.result
parent9c73436b2e7cd84192c2a55bd837415d2ad22479 (diff)
downloadmariadb-git-59b45b5b0ab0bfe470919ba5175e79307928cd79.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 mysql-test/r/metadata.result: Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs - test case mysql-test/t/metadata.test: Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs - test case sql/item.cc: Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs - use the table and db name to fill up the metadata for columns sql/sql_select.cc: Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs - preserve the field, table and DB name on dereferencing an Item_ref
Diffstat (limited to 'mysql-test/r/metadata.result')
-rw-r--r--mysql-test/r/metadata.result34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index 50b0b6ae294..34e961395c4 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -96,3 +96,37 @@ i
2
affected rows: 1
affected rows: 0
+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;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 id id 3 10 1 Y 32768 0 63
+id
+1
+select * from v1 group by id limit 0;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 id id 3 10 0 Y 32768 0 63
+id
+select * from v1 where id=1000 group by id;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 id id 3 10 0 Y 32768 0 63
+id
+select * from v1 where id=1 group by id;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 id id 3 10 1 Y 32768 0 63
+id
+1
+select * from v2 where renamed=1 group by renamed;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v2 id renamed 3 10 1 Y 32768 0 63
+renamed
+1
+select * from v3 where renamed=1 group by renamed;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def v3 renamed 8 12 0 Y 32896 0 63
+renamed
+drop table t1;
+drop view v1,v2,v3;