Bug #87726 | Error 1142 when creating view with subquery without having a default schema | ||
---|---|---|---|
Submitted: | 11 Sep 2017 13:44 | Modified: | 11 Sep 2017 22:09 |
Reporter: | Jesper Kristensen | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | 5.7.7/8.0 | OS: | Debian |
Assigned to: | CPU Architecture: | Any |
[11 Sep 2017 13:44]
Jesper Kristensen
[11 Sep 2017 16:54]
MySQL Verification Team
see https://bugs.mysql.com/bug.php?id=12755 looks like a partial fix. miguel@URAL C:\dbs > c:\dbs\5.7\bin\mysql -uroot --port=3570 -p --local-infile --prompt="mysql 5.7 > " Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.21-log Source distribution 2017-SEP-06 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.7 > CREATE DATABASE tmp; Query OK, 1 row affected (0.01 sec) mysql 5.7 > CREATE TABLE tmp.t1 (n INTEGER PRIMARY KEY); Query OK, 0 rows affected (0.05 sec) mysql 5.7 > CREATE OR REPLACE VIEW tmp.tmp AS SELECT n FROM (SELECT n FROM tmp.t1) t; ERROR 1142 (42000): ANY command denied to user 'root'@'localhost' for table '' mysql 5.7 > USE tmp Database changed mysql 5.7 > CREATE OR REPLACE VIEW tmp.tmp AS SELECT n FROM (SELECT n FROM tmp.t1) t; Query OK, 0 rows affected (0.02 sec)
[11 Sep 2017 22:09]
MySQL Verification Team
Thank you for the bug report. https://dev.mysql.com/doc/refman/5.7/en/create-view.html "A view belongs to a database. By default, a new view is created in the default database. To create the view explicitly in a given database, use db_name.view_name syntax to qualify the view name with the database name: CREATE VIEW test.v AS SELECT * FROM t; Unqualified table or view names in the SELECT statement...."