summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2006-02-01 20:43:43 -0800
committerunknown <igor@rurik.mysql.com>2006-02-01 20:43:43 -0800
commit7ea60ae91e0f0067976d21240ab07df7afdb177f (patch)
tree360fc2fd65bed95e7be429918bd9b5877bae3faa /mysql-test/t/view.test
parent11ec4175f00871dd3fee421e749f246a409b70e2 (diff)
downloadmariadb-git-7ea60ae91e0f0067976d21240ab07df7afdb177f.tar.gz
Fixed bug #16382.
When an ambiguous field name is used in a group by clause a warning is issued in the find_order_in_list function by a call to push_warning_printf. An expression that was not always valid was passed to this call as the field name parameter. mysql-test/r/view.result: Added a test case for bug #16382. mysql-test/t/view.test: Added a test case for bug #16382.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c028889184e..ed44bf3b7c0 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2363,3 +2363,20 @@ EXPLAIN SELECT MIN(a) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
+#
+# Bug#16382: grouping name is resolved against a view column name
+# which coincides with a select column name
+
+CREATE TABLE t1 (x varchar(10));
+INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT IF(x IS NULL, 'blank', 'not blank') FROM v1 GROUP BY x;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM t1 GROUP BY x;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS y FROM v1 GROUP BY y;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
+
+DROP VIEW v1;
+DROP TABLE t1;