Bug #20155 Table level CREATE VIEW grants don't appear to be working
| Submitted: | 30 May 2006 21:31 | Modified: | 8 Jun 2006 9:21 |
|---|---|---|---|
| Reporter: | Erica Moss | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | WIN -5.0.21 LIN 5.0.22 | OS: | Windows (win32 - XP SP2, Fedora core 5) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[8 Jun 2006 9:21]
Georgi Kodinov
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Additional info: This is a duplicate of Bug#7091
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: The below mysql-test script demonstrates this problem. A new user is granted only CREATE VIEW and SELECT on a specific table. That user then tries to create a VIEW that references that table. When that CREATE VIEW statement is reached the following error is thrown: Errors are (from /home/emalossi/mysql-5.0/mysql-test/var/log/mysqltest-time) : mysqltest: At line 17: query 'CREATE VIEW privDB.v1 AS SELECT * FROM privDB.t1' failed: 1142: CREATE VIEW command denied to user 'create_view_tbl'@'localhost' for table 'v1' This was tried on both windows and linux builds with the same results. This same error will occur even if the CREATE VIEW statement doesn't even reference table t1, such as: CREATE VIEW privDB.v1 AS SELECT CURRENT_USER(); IF this line is commented out, and the script allowed to finish, it is apparent from the results that this new user is in fact being created with the requested permissions, however they don't seem to be taking effect when they should. How to repeat: connect (root, localhost, root,,); CREATE DATABASE privDB; CREATE TABLE privDB.t1 (c1 INT); GRANT CREATE VIEW ON privDB.t1 TO 'create_view_tbl'@'localhost' IDENTIFIED BY 'create_view_tbl'; GRANT SELECT ON privDB.t1 TO 'create_view_tbl'@'localhost'; SELECT user, db, table_name, table_priv FROM mysql.tables_priv WHERE user='create_view_tbl'; connect (create_view_tbl, localhost, create_view_tbl, create_view_tbl,); use privDB; SELECT CURRENT_USER(); CREATE VIEW privDB.v1 AS SELECT * FROM privDB.t1; connection root; SELECT * FROM privDB.v1; DROP VIEW privDB.v1; DROP TABLE privDB.t1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'create_view_tbl'@'localhost'; DROP USER 'create_view_tbl'@'localhost';