fix!: EXPOSED-569 groupConcat uses wrong SQLite syntax & ignores DISTINCT in Oracle & SQL Server #2257
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.
Description
Summary of the change:
groupConcat()
no longer generates wrong SQL syntax for SQLite and no longer ignores unsupported parameters for Oracle and SQL Server.Detailed description:
It was observed by a user that SQLite uses the wrong syntax for a separator in its
GROUP_CONCAT
funtion. They were also attempting to use the ORDER BY clause, which Exposed prevents because the database used to not support it. ORDER BY with aggregate functions has been supported since version 3.44.0.While adjusting the tests to no longer exclude, it was confirmed that SQL Server doesn't actually support DISTINCT in the function. Exposed was ignoring this value if set to
true
and not including it in SQL, whereas the usual behavior is to fail early.Oracle was doing the same thing for DISTINCT. But it was also, for some reason, preventing
groupConcat()
from being used unless an argument fororderBy
was provided. ORDER BY is supposed to be optional withLISTAGG
function.(expr, '?')
syntax instead of(expr, SEPARATOR '?')
. Allows arguments to be passed toorderBy
for syntax(expr, '?' ORDER BY col)
.UnsupportedByDialectException
ifdialect
is set totrue
.orderBy
. ThrowsUnsupportedByDialectException
ifdialect
is set totrue
.Type of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues
EXPOSED-569