Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Fix grouping of WITHIN GROUP aggregates - #905

Closed
banlor wants to merge 1 commit into
andialbrecht:masterfrom
banlor:fix/within-group-700
Closed

banlor wants to merge 1 commit into
andialbrecht:masterfrom
banlor:fix/within-group-700

Conversation

@banlor

@banlor banlor commented Sep 16, 2026

Copy link
Copy Markdown

Group WITHIN GROUP (...) with its aggregate before resolving column aliases. This fixes LISTAGG(...) WITHIN GROUP(...) AS name being split into two columns.

The grouping also handles an optional OVER clause, comments between clauses, nested aggregates and parameter extraction. WITHIN on its own remains usable as an alias.

Fixes #700.

Tested on Windows with Python 3.11: pytest tests/ and ruff check sqlparse/.

  • ran the tests (pytest)
  • all style issues addressed (ruff)
  • changes are covered by tests
  • changes are documented in the changelog

@banlor banlor mentioned this pull request Sep 23, 2026
4 tasks done
Fixes andialbrecht#700

Signed-off-by: Mikhail Basov <michael.s.basov@gmail.com>
@banlor
banlor force-pushed the fix/within-group-700 branch from 059cfe2 to dbe2116 Compare November 29, 2026 19:16

Copy link
Copy Markdown
Owner

Thanks so much for this PR, and sorry it never got merged!

I've decided to stop maintaining sqlparse, and 0.6.1 was the last release. So I'm closing all open pull requests. That's not because of your work, I just won't be merging or releasing anything anymore. If you're curious why: #945

Thanks again for caring about sqlparse! ❤️


Generated by Claude Code

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.

Incorrect parsing of string aggregation with group ordering ("LISTAGG(...) WITHIN GROUP(ORDER BY ... )")

2 participants