Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

'Explain' button in Query Workbench produces broken/empty modal on malformed query #863

Closed
stockholmux opened this issue Nov 27, 2020 · 5 comments
Assignees
Labels
bug Something isn't working SQL Workbench

Comments

@stockholmux
Copy link

Input an invalid query - example:

SHOW tables LIKE 1;

Then click the 'Explain' button you get a strange, empty UI modal:

Screen Shot 2020-11-27 at 7 55 46 AM

I would expect an error message, not an empty box. I assume this is related #586 .

@chloe-zh
Copy link
Member

Hi @stockholmux thank you for reporting this issue, will do the enhancement once we have resources.

@davidcui1225
Copy link
Contributor

Related: #404
Need to determine what the best behavior for Explain on SHOW/DESCRIBE queries are

@dai-chen
Copy link
Member

I checked other database like MySQL. It doesn't allow EXPLAIN on metadata queries such as SHOW/DESCRIBE. In our case, I think EXPLAIN should only work with queries and disabled for other statements from both frontend and backend.

mysql> DESCRIBE accounts;
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| age   | int  | YES  |     | NULL    |       |
+-------+------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> EXPLAIN DESCRIBE accounts;
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 'DESCRIBE accounts' at line 1

MySQL doc: https://dev.mysql.com/doc/refman/8.0/en/explain.html

explainable_stmt: {
    SELECT statement
  | TABLE statement
  | DELETE statement
  | INSERT statement
  | REPLACE statement
  | UPDATE statement
}

@davidcui1225
Copy link
Contributor

Looks like Solution Plan will have to come in 2 places:

  • Query Workbench: Disable Explain button on front-end for all non-SELECT queries
  • SQL/PPL: Throw Exception in backend with clear error message that Explain is not supported for non-SELECT queries

@dai-chen dai-chen added the SQL label Nov 30, 2020
@anirudha anirudha added the bug Something isn't working label Nov 30, 2020
@davidcui1225
Copy link
Contributor

Fixed in #872

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working SQL Workbench
Projects
None yet
Development

No branches or pull requests

5 participants