Skip to content

SQL parser: ORDER BY on a bare table alias produces an empty column name (dangling qualifier) #159

Description

@fupelaqu

Symptom

When an ORDER BY identifier collides with a table alias — e.g.

SELECT e.name FROM emp e ORDER BY e

GenericIdentifier.update (sql/src/main/scala/app/softnetwork/elastic/sql/package.scala, alias-split logic ~L1224-1234) splits the identifier into name = "" and tableAlias = Some("e"). The reconstructed SQL then contains a dangling qualifier (ORDER BY e.); before the #158 fix it rendered ORDER BY ASC (empty name). Either way the statement is silently malformed instead of being rejected.

Scope

Proposed fix

Reject the split in GenericIdentifier.update when the remaining column name is empty (validation error such as "Column name expected after table alias 'e'"), instead of manufacturing an empty identifier.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions