Skip to content

Conversation

mk3008
Copy link
Owner

@mk3008 mk3008 commented Jul 28, 2025

Clarifies UNION ORDER BY semantics by extracting ORDER BY clause from
the rightmost query in binary operations and moving it to the outer
SimpleSelectQuery level. This transforms ambiguous ORDER BY positioning
into explicit subquery structure.

Changes:

  • Add ORDER BY extraction logic to QueryBuilder.buildSimpleBinaryQuery()
  • Implement recursive ORDER BY detection in binary query trees
  • Move ORDER BY from individual subqueries to wrapper SimpleQuery
  • Add comprehensive tests for ORDER BY movement scenarios
  • Document SQL standard behavior for UNION ORDER BY clauses

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Clarifies UNION ORDER BY semantics by extracting ORDER BY clause from
the rightmost query in binary operations and moving it to the outer
SimpleSelectQuery level. This transforms ambiguous ORDER BY positioning
into explicit subquery structure.

Changes:
- Add ORDER BY extraction logic to QueryBuilder.buildSimpleBinaryQuery()
- Implement recursive ORDER BY detection in binary query trees
- Move ORDER BY from individual subqueries to wrapper SimpleQuery
- Add comprehensive tests for ORDER BY movement scenarios
- Document SQL standard behavior for UNION ORDER BY clauses

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@mk3008 mk3008 merged commit ce667b0 into main Jul 28, 2025
8 checks passed
@mk3008 mk3008 deleted the feat_to_simple_query branch July 28, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant