[MDEV-10078] sql_yacc.yy: Remove non-parenthesized SELECT from table_factor Created: 2016-05-17  Updated: 2016-05-17  Resolved: 2016-05-17

Status: Closed
Project: MariaDB Server
Component/s: Parser
Fix Version/s: 10.2.1

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-8909 union parser cleanup Closed

 Description   

sql_yacc.yy has this grammar:

join_table:
...
| table_ref NATURAL inner_join table_factor
| table_ref LEFT opt_outer JOIN_SYM table_factor USING ...
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
| table_ref RIGHT opt_outer JOIN_SYM table_factor USING ...
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor ...

table_factor:
  table_ident opt_use_partition opt_table_alias opt_key_definition
| select_derived_init get_select_lex select_derived2
| '('opt_with_clause get_select_lex select_derived_union ')' opt_table_alias

The branch in table_factor that starts with "select_derived" represents a non-parenthesized SELECT query and cannot appear in the rights side of "join_table". For example, this query is syntactically incorrect:

SELECT * FROM t1 NATURAL JOIN SELECT * FROM t2;

There must be parentheses around the right SELECT.

Under term of this task we'll remove the impossible part from table_factor.


Generated at Thu Feb 08 07:39:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.