datacamp / antlr-plsql

GNU Affero General Public License v3.0
17 stars 14 forks source link

Bad support for subqueries in the FROM clause #30

Open filipsch opened 5 years ago

filipsch commented 5 years ago

See this example on ast-viewer.datacamp.com.

A bunch of unshaped nodes.

machow commented 5 years ago

It looks like quite a few things can go into the FROM clause in a SELECT statement. If we just want to add support for subqueries here, I think we can just handle that case in the dml_expression_clause rule in the grammar.

https://github.com/datacamp/antlr-plsql/blob/master/antlr_plsql/plsql.g4#L1293

From what I can tell the three changes are:

  1. support a list of table expressions in the FROM clause (see this query)
  2. implement some AST structure for table aliases (see this query)
  3. handle subqueries in the FROM clause (see this query)