Bug #88468 | SELECT with wrong parenthesis is accepted | ||
---|---|---|---|
Submitted: | 13 Nov 2017 21:13 | Modified: | 14 Nov 2017 8:14 |
Reporter: | Federico Razzoli (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[13 Nov 2017 21:13]
Federico Razzoli
[13 Nov 2017 21:19]
Federico Razzoli
Note that I only reported a real case, but I didn't test if similar illegal syntaxes are also accepted.
[13 Nov 2017 22:03]
MySQL Verification Team
If the bug report only refers about parenthesis of part(select ...where..) disregarding the other particularities of MySQL syntax (i.e limit) below an example how Oracle 12C Databases behaves: C:\>sqlplus SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 13 19:57:28 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter user-name: system Enter password: Last Successful login time: Mon Nov 13 2017 19:36:21 -02:00 Connected to: Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production SQL> (SELECT users.id AS xid FROM users WHERE deleted = 0) ORDER BY user_name; no rows selected SQL>
[14 Nov 2017 7:28]
Roy Lyseng
This is actually standard compliant syntax. The statement (SELECT users.id AS __id FROM users WHERE deleted = false) ORDER BY user_name LIMIT 2790060, 60; complies to the syntax rules: <query expression> ::= <query expression body> <order by clause> <result offset clause> <query expression body> ::= <query term> <query term> ::= <query primary> <query primary> ::= <left paren> <query expression body> <right paren> ... <query primary> ::=<simple table> <simple table> ::= <query specification> <query specification> ::= SELECT [ <set quantifier> ] <select list> <table expression> Irrelevant syntax rules have been removed for brevity, and we ignore the non-standard LIMIT clause.
[14 Nov 2017 8:14]
Federico Razzoli
So, it's weird but standard compliant. Thanks for clarification.