summaryrefslogtreecommitdiff
path: root/mysql-test/t/view_grant.test
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@sun.com>2009-10-16 13:12:21 +0200
committerMartin Hansson <martin.hansson@sun.com>2009-10-16 13:12:21 +0200
commit3bd24616684258cc45915e7f0a550dc20c7385bd (patch)
treeb4cbdfc446fc7133bc8d8b8560ea6e2950876c9e /mysql-test/t/view_grant.test
parentd7cc9194e0d657fb475cf14a3463a976d336b63a (diff)
downloadmariadb-git-3bd24616684258cc45915e7f0a550dc20c7385bd.tar.gz
Bug#46019: ERROR 1356 When selecting from within another
view that has Group By When SELECT'ing from a view that mentions another, materialized, view, access was being denied. The issue was resolved by lifting a special case which avoided such access checking in check_single_table_access. In the past, this was necessary since if such a check were performed, the error message would be downgraded to a warning in the case of SHOW CREATE VIEW. The downgrading of errors was meant to handle only that scenario, but could not distinguish the two as it read only the error messages. The special case was needed in the fix of bug no 36086. Before that, views were confused with derived tables. After bug no 35996 was fixed, the manipulation of errors during SHOW CREATE VIEW execution is not dependent on the actual error messages in the queue, it rather looks at the actual cause of the error and takes appropriate action. Hence the aforementioned special case is now superfluous and the bug is fixed. mysql-test/r/view_grant.result: Bug#46019: Test result. mysql-test/t/view_grant.test: Bug#46019: Test case. sql/sql_parse.cc: Bug#46019: fix.
Diffstat (limited to 'mysql-test/t/view_grant.test')
-rw-r--r--mysql-test/t/view_grant.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index 2ad488b7529..175468db702 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -1506,3 +1506,29 @@ DROP VIEW v1;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # Bug #46019: ERROR 1356 When selecting from within another
+--echo # view that has Group By
+--echo #
+CREATE DATABASE mysqltest1;
+USE mysqltest1;
+
+CREATE TABLE t1 (a INT);
+
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
+CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
+
+CREATE USER mysqluser1;
+
+GRANT SELECT ON TABLE t1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
+
+--connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
+SELECT a FROM v1;
+SELECT a FROM v2;
+
+--connection default
+--disconnect mysqluser1
+DROP USER mysqluser1;
+DROP DATABASE mysqltest1;