Skip to content

Support OrderBy and Sort in Expr->String #10256

@yyy1000

Description

@yyy1000

Is your feature request related to a problem or challenge?

The current implementation in #9936 for Sort is probably not correct.
It ignores asc and null_first field.
IMO, the better struct for Sort and order_by is OrderByExpr
https://github.com/sqlparser-rs/sqlparser-rs/blob/deaa6d8151c8f90a7e9cbb624876fe0e8b8a165d/src/ast/query.rs#L1444-L1450
However, OrderByExpr is not an enum item in Expr

Describe the solution you'd like

two steps:

  1. make OrderByExpr an enum in Expr (change in sql-parser)
  2. make Sort return a OrderByExpr during Expr->String

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions