summaryrefslogtreecommitdiff
path: root/mysql-test/r/metadata.result
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-06-20 12:25:07 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-06-20 12:25:07 +0500
commite855bf33b36586c4abca0b905608682f21752b75 (patch)
treee162ae4184c77818fe0e9da47c77391b89a59664 /mysql-test/r/metadata.result
parentbcd6183fe7f242648ce6e04c8224c98531f1cbff (diff)
downloadmariadb-git-e855bf33b36586c4abca0b905608682f21752b75.tar.gz
Fixed bug #28898.
For a join query with GROUP BY and/or ORDER BY and a view reference in the FROM list the metadata erroneously showed empty table aliases and database names for the view columns. sql/item.h: Fixed bug #28898. Body of Item_ref::get_tmp_table_item method has been moved to item.cc file. mysql-test/t/metadata.test: Updated test case for bug #28898. sql/item.cc: Fixed bug #28898. The Item_ref::get_tmp_table_item method has been modified to copy pointers to the table alias and database name to the new Item_field object created for a field stored in the temporary table. mysql-test/r/metadata.result: Updated test case for bug #28898. sql/sql_select.cc: Fixed bug #28898. The change_to_use_tmp_fields function has been modified to to copy pointers to the table alias and database name from the Item_ref objects to the new Item_field objects created for fields stored in the temporary table.
Diffstat (limited to 'mysql-test/r/metadata.result')
-rw-r--r--mysql-test/r/metadata.result41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index d33fb038b79..283dc8a02ae 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -140,4 +140,45 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def a v_small v_small 3 9 9 N 32769 0 63
v_small
214748364
+CREATE TABLE t1 (c1 CHAR(1));
+CREATE TABLE t2 (c2 CHAR(1));
+CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
+CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
+SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 0 0 8
+c1
+1
+2
+2
+3
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 0 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+2 2
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+DROP VIEW v1;
+DROP TABLE t1,t2;
End of 5.0 tests