Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

group or groups table names break the parser #1537

Closed
slve opened this issue Oct 7, 2021 · 0 comments · Fixed by #1546
Closed

group or groups table names break the parser #1537

slve opened this issue Oct 7, 2021 · 0 comments · Fixed by #1546
Labels
ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard bug Something isn't working

Comments

@slve
Copy link

slve commented Oct 7, 2021

echo -e 'select 1 from group' | sqlfluff parse -
[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    statement:
[L:  1, P:  1]      |        select_statement:
[L:  1, P:  1]      |            select_clause:
[L:  1, P:  1]      |                keyword:                                      'select'
[L:  1, P:  7]      |                [META] indent:
[L:  1, P:  7]      |                whitespace:                                   ' '
[L:  1, P:  8]      |                select_clause_element:
[L:  1, P:  8]      |                    literal:                                  '1'
[L:  1, P:  9]      |            whitespace:                                       ' '
[L:  1, P: 10]      |            [META] dedent:
[L:  1, P: 10]      |            from_clause:
[L:  1, P: 10]      |                unparsable:                                   !! Expected: 'FromClauseSegment'
[L:  1, P: 10]      |                    keyword:                                  'from'
[L:  1, P: 14]      |            unparsable:                                       !! Expected: 'Nothing...'
[L:  1, P: 14]      |                whitespace:                                   ' '
[L:  1, P: 15]      |                raw:                                          'group'
[L:  1, P: 20]      |    newline:                                                  '\n'

==== parsing violations ====
L:   1 | P:  10 |  PRS | Line 1, Position 10: Found unparsable section: 'from'
L:   1 | P:  14 |  PRS | Line 1, Position 14: Found unparsable section: ' group'

Expected Behaviour

echo -e 'select 1 from anyothertablename' | sqlfluff parse -
[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    statement:
[L:  1, P:  1]      |        select_statement:
[L:  1, P:  1]      |            select_clause:
[L:  1, P:  1]      |                keyword:                                      'select'
[L:  1, P:  7]      |                [META] indent:
[L:  1, P:  7]      |                whitespace:                                   ' '
[L:  1, P:  8]      |                select_clause_element:
[L:  1, P:  8]      |                    literal:                                  '1'
[L:  1, P:  9]      |            whitespace:                                       ' '
[L:  1, P: 10]      |            [META] dedent:
[L:  1, P: 10]      |            from_clause:
[L:  1, P: 10]      |                keyword:                                      'from'
[L:  1, P: 14]      |                whitespace:                                   ' '
[L:  1, P: 15]      |                from_expression:
[L:  1, P: 15]      |                    [META] indent:
[L:  1, P: 15]      |                    from_expression_element:
[L:  1, P: 15]      |                        table_expression:
[L:  1, P: 15]      |                            table_reference:
[L:  1, P: 15]      |                                identifier:                   'anyothertablename'
[L:  1, P: 32]      |                    [META] dedent:
[L:  1, P: 32]      |    newline:                                                  '\n'

Observed Behaviour

  • Using group or groups as table name breaks parsing.
  • Note: using group as column name is fine.

Steps to Reproduce

  • echo -e 'select 1 from group' | sqlfluff parse -
  • echo -e 'select 1 from groups' | sqlfluff parse -

Dialect

  • All

Version

sqlfluff --version
sqlfluff, version 0.6.8

Configuration

  • No config, using defaults.
@slve slve added the bug Something isn't working label Oct 7, 2021
@slve slve changed the title group table name breaks the parser group or groups table names break the parser Oct 7, 2021
@tunetheweb tunetheweb added the ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard label Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants