Bug #88591 When no default dataabse incorrect error occurs
Submitted: 21 Nov 2017 12:26 Modified: 21 Mar 2018 5:55
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:8.03 OS:Any
Assigned to: CPU Architecture:Any

[21 Nov 2017 12:26] Peter Laursen
Description:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.3-rc-log MySQL Community Server (GPL)

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> explain extended select 1;
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> explain extended select 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 1' at line 1
mysql>

How to repeat:
See above. Also note that in pre-8 server versions a default database is not required to execute the statement. And on 8.x a plain EXPLAIN it also still is not.

Suggested fix:
Error 1064 should be returned in both cases, as EXPLAIN EXTENDED is no longer supported (with or without an active database context).
[21 Nov 2017 16:33] MySQL Verification Team
Thank you for the bug report. Verified as described.
[21 Mar 2018 5:55] Jon Stephens
Documented fix in the MySQL 8.0.11 changelog as follows:

    When executed prior to selecting a database, EXPLAIN EXTENDED
    raised Error 1046 No database selected instead of an SQL syntax
    error due to the fact that the EXTENDED keyword has been
    removed.

Closed.