Bug #19953 Incomplete error when attempting to CREATE VIEW without SELECT GRANT
Submitted: 19 May 2006 18:58 Modified: 28 Feb 2007 22:25
Reporter: Erica Moss Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Views Severity:S3 (Non-critical)
Version:5.0.21-community-nt OS:Microsoft Windows (win32 - XP SP2)
Assigned to:
Triage: Triaged: D4 (Minor) / R2 (Low) / E2 (Low)

[19 May 2006 18:58] Erica Moss
Description:
If a user with CREATE VIEW grant but not SELECT GRANT tries to create a view that references a table, the error that is generated is the proper error number but the error message is built incorrectly:

ERROR 1142 (42000): ANY command denied to user \
          'create_view'@'localhost' for table 't1'

'ANY' should be 'SELECT'

How to repeat:
# as root user
GRANT CREATE VIEW ON privDB.* TO 'create_view'@'localhost'
        IDENTIFIED BY 'create_view';

# Log in as create_view
CREATE VIEW view_foo AS SELECT * FROM test.foo;

# result
# ERROR 1142 (42000): ANY command denied to user \
#          'create_view'@'localhost' for table 'foo'

# if you do this though you get the correct error
SELECT * FROM test.foo;

# result
# ERROR 1142 (42000): SELECT command denied to user \
#           'create_view'@'localhost' for table 'foo'