andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.76k stars 700 forks source link

Incorrect grouping for Identifiers #712

Open cwelton opened 1 year ago

cwelton commented 1 year ago

Example:

select count(*)
from 
  -- In SQL, Identifiers
  my_namespace 
  -- can have whitespace
  . 
  -- and comments
  "my_table"
  -- in between the tokens
  as 
  -- comments can go anywhere really
  my_alias
where
   my_alias 
   -- also true here
   .
   -- Yes, a little silly, but important
   my_value is not Null

In the above there are two identifiers "my_namespace.mytable as my_alias" and "myalias.myvalue", neither of them is correctly grouped.