summaryrefslogtreecommitdiff
path: root/mysql-test/t/view_grant.test
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-08-19 15:14:57 +0300
committerGeorgi Kodinov <joro@sun.com>2009-08-19 15:14:57 +0300
commit0665536995fa1afe4ac71e13451dd8258063ff36 (patch)
treeec3d6929232f89d5951fb478830ddf37d9aa403b /mysql-test/t/view_grant.test
parent40defb1d53e6978bdfcd4fc67f638cb56fa58ebb (diff)
downloadmariadb-git-0665536995fa1afe4ac71e13451dd8258063ff36.tar.gz
Bug #46019: ERROR 1356 When selecting from within another
view that has Group By Table access rights checking function check_grant() assumed that no view is opened when it's called. This is not true with nested views where the inner view needs materialization. In this case the view is already materialized when check_grant() is called for it. This caused check_grant() to not look for table level grants on the materialized view table. Fixed by checking if a view is already materialized and if it is check table level grants using the original table name (not the ones of the materialized temp table).
Diffstat (limited to 'mysql-test/t/view_grant.test')
-rw-r--r--mysql-test/t/view_grant.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index ff17cde5184..0a8456afec2 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -1232,6 +1232,42 @@ DROP TABLE db1.t1;
DROP DATABASE db1;
connection default;
+
+--echo #
+--echo # Bug #46019: ERROR 1356 When selecting from within another
+--echo # view that has Group By
+--echo #
+
+CREATE DATABASE db1;
+USE db1;
+
+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 u1;
+
+GRANT SELECT ON TABLE t1 TO u1;
+GRANT SELECT, SHOW VIEW ON TABLE v1 TO u1;
+GRANT SELECT, SHOW VIEW ON TABLE v2 TO u1;
+
+CONNECT (u1, localhost, u1,,db1);
+CONNECTION u1;
+
+SELECT a FROM v1;
+SELECT a FROM v2;
+
+CONNECTION default;
+DISCONNECT u1;
+DROP USER u1;
+DROP VIEW v1,v2;
+DROP TABLE t1;
+USE test;
+DROP DATABASE db1;
--echo End of 5.0 tests.
# Wait till we reached the initial number of concurrent sessions