Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
10.2.1-1
Description
The "table_expression" rule currently looks like this:
table_expression:
|
opt_from_clause
|
opt_where_clause
|
opt_group_clause
|
opt_having_clause
|
opt_window_clause
|
opt_order_clause
|
opt_limit_clause
|
opt_procedure_clause
|
opt_select_lock_type
|
;
|
We'll do the following refactoring:
1. Remove the extra parts (opt_order_clause, opt_limit_clause, opt_procedure_clause, opt_select_lock_type parts), and make the "from_clause" non-optional:
table_expression:
|
from_clause
|
opt_where_clause
|
opt_group_clause
|
opt_having_clause
|
opt_window_clause
|
;
|
After this change table_expression will match the SQL Standard <table expression> production.
2. Add the "opt_table_expression" rule
3. Move the extra parts of the ex-table_expression to the "caller" rules, and remove the opt_procedure_clause from non-relevant places.
It will change these queries using subselects and derived table:
SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE()); |
SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE()); |
SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2; |
SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2; |
as well as:
CREATE TABLE t2 SELECT * FROMt1 PROCEDURE ANALYSE(); |
to return "syntax error" instead of "Incorrect usage".
Attachments
Issue Links
- blocks
-
MDEV-8909 union parser cleanup
-
- Closed
-
Activity
Description |
The "table_expression" rule currently looks like this:
{code} table_expression: opt_from_clause opt_where_clause opt_group_clause opt_having_clause opt_window_clause opt_order_clause opt_limit_clause opt_procedure_clause opt_select_lock_type ; {code} We'll do the following refactoring: 1. Remove the extra parts (opt_order_clause, opt_limit_clause, opt_procedure_clause, opt_select_lock_type parts), and make the "from_clause" non-optional: {code} table_expression: from_clause opt_where_clause opt_group_clause opt_having_clause opt_window_clause ; {code} After this change table_expression will match the SQL Standard <table expression> production. 2. Add the "opt_table_expression" rule 3. Move the extra parts of the ex-table_expression to the "caller" rules, and remove the opt_procedure_clause from non-relevant places. It will change these queries using subselects and derived table: {code:sql} SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE()); SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE()); SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2; SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2; {code} to return "syntax error" instead of "Incorrect usage". |
The "table_expression" rule currently looks like this:
{code} table_expression: opt_from_clause opt_where_clause opt_group_clause opt_having_clause opt_window_clause opt_order_clause opt_limit_clause opt_procedure_clause opt_select_lock_type ; {code} We'll do the following refactoring: 1. Remove the extra parts (opt_order_clause, opt_limit_clause, opt_procedure_clause, opt_select_lock_type parts), and make the "from_clause" non-optional: {code} table_expression: from_clause opt_where_clause opt_group_clause opt_having_clause opt_window_clause ; {code} After this change table_expression will match the SQL Standard <table expression> production. 2. Add the "opt_table_expression" rule 3. Move the extra parts of the ex-table_expression to the "caller" rules, and remove the opt_procedure_clause from non-relevant places. It will change these queries using subselects and derived table: {code:sql} SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE()); SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE()); SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2; SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2; {code} as well as: {code:sql} CREATE TABLE t2 SELECT * FROMt1 PROCEDURE ANALYSE(); {code} to return "syntax error" instead of "Incorrect usage". |
Sprint | 10.2.1-1 [ 56 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Alexander Barkov [ bar ] | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Sergei Golubchik [ serg ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Affects Version/s | 10.2 [ 14601 ] | |
Issue Type | Bug [ 1 ] | Task [ 3 ] |
Component/s | Parser [ 10201 ] | |
Fix Version/s | 10.2.1 [ 22012 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 75587 ] | MariaDB v4 [ 132863 ] |