Skip to content

problem with renaming as "e1" or "e2" in from-clause #399

Closed
@Meffi42

Description

@Meffi42

I have a from-clause where I rename relations as "e1, e2, ..." - this seems problematic,
e.g., "e2" is recognized as a float:

list( sqlparse.parse("select * from Eats e1, Eats e2")[0] )[6].value
'Eats'
list( sqlparse.parse("select * from Eats e1, Eats e2")[0] )[8].value
'e1, Eats'

list( sqlparse.parse("select * from Eats e1, Eats e2")[0] )[10].value
'e2'
list( sqlparse.parse("select * from Eats e1, Eats e2")[0] )[10].ttype
Token.Literal.Number.Float

Using different identifiers, such as "a" or "b" works:

list( sqlparse.parse("select * from Eats a, Eats b")[0] )[6].value
'Eats a, Eats b'

type( list( sqlparse.parse("select * from Eats a, Eats b")[0] )[6] )
<class 'sqlparse.sql.IdentifierList'>

Activity

collerek

collerek commented on Jul 14, 2021

@collerek

Can confirm this is still valid, is this related to exponentials, or it's a bug?
@andialbrecht, any thoughts?

added this to the 0.4.2 milestone on Jul 14, 2021
andialbrecht

andialbrecht commented on Jul 14, 2021

@andialbrecht
Owner

Yes, it's a bug. And it's fixed now. Thanks for reporting and bringing this up again!

added a commit that references this issue on Mar 9, 2024
e660467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @andialbrecht@Meffi42@collerek

        Issue actions

          problem with renaming as "e1" or "e2" in from-clause · Issue #399 · andialbrecht/sqlparse