Skip to content

Commit

Permalink
fix!: EXPOSED-569 groupConcat uses wrong SQLite syntax & ignores DIST…
Browse files Browse the repository at this point in the history
…INCT in

Oracle & SQL Server

- Fixed wrong function name in exception message
- Change to use appendTo() with prefix
  • Loading branch information
bog-walk committed Sep 26, 2024
1 parent 974c95f commit 704093e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ class Concat(
}

/**
* Represents an SQL function that concatenates the text representation of all non-null input values of each group
* from [expr], separated by [separator].
* Represents an SQL function that concatenates the text representation of all non-null input values of each group from [expr], separated by [separator]
*/
class GroupConcat<T : String?>(
/** Returns grouped expression being concatenated. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal object OracleFunctionProvider : FunctionProvider() {
queryBuilder: QueryBuilder
): Unit = queryBuilder {
val tr = TransactionManager.current()
if (expr.distinct) tr.throwUnsupportedException("Oracle doesn't support DISTINCT in STRING_AGG")
if (expr.distinct) tr.throwUnsupportedException("Oracle doesn't support DISTINCT in LISTAGG")
if (expr.orderBy.size > 1) {
tr.throwUnsupportedException("Oracle supports only single column in ORDER BY clause in LISTAGG")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ internal object SQLiteFunctionProvider : FunctionProvider() {
+", '$it'"
}
if (expr.orderBy.isNotEmpty()) {
+" ORDER BY "
expr.orderBy.appendTo { (expression, sortOrder) ->
expr.orderBy.appendTo(prefix = " ORDER BY ") { (expression, sortOrder) ->
currentDialect.dataTypeProvider.precessOrderByClause(this, expression, sortOrder)
}
}
Expand Down

0 comments on commit 704093e

Please sign in to comment.