fix: add SQLExpressions.stringAgg and ensure proper spacing for WITHI…#1258
Closed
renechoi wants to merge 1 commit intoOpenFeign:masterfrom
Conversation
…N GROUP ORDER BY * Added SQLExpressions.stringAgg(...) convenience method that wraps PostgreSQL string_agg, enabling fluent use with withinGroup().orderBy(). * Updated PostgreSQLTemplates to emit the mandatory space before WITHIN GROUP so generated SQL is syntactically correct. * Added unit test StringAggWithinGroupOrderByTest to prevent regressions and document expected query output.
Member
|
Hi @renechoi , thanks for your contributions, can you please take a look and fix the issues on CI. I'm happy to review the changes after we get a green build |
Member
|
Build is red, feel free to reopen when you get it working. thanks for the support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Pull-Request Description
What & Why
PostgreSQL’s
string_agg( … ) WITHIN GROUP (ORDER BY …)was rendered without the required space beforeWITHIN GROUP, producing invalid SQL such asThe root cause is documented in the upstream bug report
➡️ [querydsl/querydsl #3851](querydsl/querydsl#3851).
This PR ports the fix to the
openfeign/querydslfork so downstream consumers get the corrected SQL generation.Changes in this PR
querydsl-sql/src/main/java/com/querydsl/sql/dsl/SQLExpressions.javastringAgg(Expression<String>, Expression<?> separator)convenience method, mirroring other aggregate helpers and enabling fluentwithinGroup().orderBy(… )chaining.querydsl-sql/src/main/java/com/querydsl/sql/PostgreSQLTemplates.javastring_aggandWITHIN GROUP, producing valid SQL.querydsl-sql/src/test/java/.../StringAggWithinGroupOrderByTest.javastring_agg(foo.name,';') WITHIN GROUP (ORDER BY foo.id asc); fails on old code, passes after fix.Before vs. After
string_agg(foo.name,';')WITHIN GROUP(ORDER BY foo.id asc)string_agg(foo.name,';') WITHIN GROUP (ORDER BY foo.id asc)Compatibility
stringAgg) and template fix.Tests & CI
easy-jacoco-maven-pluginresolution and is unrelated to this patch. I can follow up with a workflow or version pin if desired.Related
🤝 Thanks for reviewing!