New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate non-aggregate string.Join to CONCAT_WS on SQL Server #28900
base: release/7.0
Are you sure you want to change the base?
Conversation
does that mean any result string crossing 8000 (or 4000 if unicode), will be truncated? |
Is this required for 7.0? |
Yes 🙄 If there's a single varchar/nvarchar(max) in there, the result is also max, so no truncation occurs. So this only affects the case where all arguments (and the delimiter) are non-max.
No, not required.. The reason I did this is that we've added string.Join translation in another context (aggregate), so it's nice to be able to just say "we now support string.Join" (in both aggregate and non-aggregate contexts). It also seems very low-risk, but if we're against it we can do it for 8.0. |
It is not very "low-risk". I prefer not to do it. Not really a frequently asked feature. |
Well, it's just a new translation for something we didn't translate before, so I'm not sure in what sense the risk can be high. If you're concerned specifically with the truncation, we can introduce a CAST to varchar/nvarchar(max) e.g. on the delimiter, which would work around that. Or we can leave it as-is as a SQL Server quirk, like how we do with trailing whitespace. |
Making this a draft as we're not doing this in 7.0. |
Note: CONCAT_WS exists since SQL Server 2017 (14.x). We can use the compatibility level (#30163) to determine whether to translate or not (or to throw). |
As usual, this was a bit more tricky than it looks.
varchar(14)
. We don't have column/parameter values, so I'm setting the return mapping to be varchar(max) or nvarchar(max) (based on whether we've seen nvarchar or not). See below forCloses #28899
Interesting experiments for CONCAT_WS result type