tree-sitter-sql icon indicating copy to clipboard operation
tree-sitter-sql copied to clipboard

Improve from clause

Open pplam opened this issue 2 years ago • 2 comments

Improved the FROM clause in SELECT statement to make it more general, ref: https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM

pplam avatar Jun 26 '22 04:06 pplam

@m-novikov This PR is depend on PR#41, please merge PR#41 first

pplam avatar Jun 26 '22 04:06 pplam

Sorry have little time these days. I'll merge https://github.com/m-novikov/tree-sitter-sql/pull/63 first so I can actually comment on PRs, this would need rebase. I also disagree with changes to alliases: For example:

@@ -104,13 +104,13 @@ SELECT a, b AS c FROM table1 AS t;
   (select_statement
     (select_clause
       (select_clause_body
+        (identifier)
         (identifier)
         (alias
-          (identifier)
           (identifier))))
     (from_clause
+      (identifier)
       (alias
-        (identifier)
         (identifier)))))

When using expand selection used on aliased expression I would expect it to select b AS c but with the current structure, it doesn't seem to be possible.

m-novikov avatar Jul 10 '22 18:07 m-novikov