Skip to content

Fix select concat - #39269

Merged
AndriySvyryd merged 7 commits into
dotnet:mainfrom
Aziz-Dhiab:fix-select-concat
Oct 16, 2026
Merged

AndriySvyryd merged 7 commits into
dotnet:mainfrom
Aziz-Dhiab:fix-select-concat

Conversation

@Aziz-Dhiab

Copy link
Copy Markdown
Contributor

fixes #33061

Exclude strings from being considered an array of constants for the purpose of being a Query Root Candidate

Added a base regression test and a translation for SQL Server to make sure the query is selecting the string column only

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Captured string parameters may still be treated as primitive collection query roots.

1 open finding
What changed in this PR

Fixes string Concat query translation by preventing literal strings from being treated as primitive collection query roots.

Changes:

  • Excludes string constants from query-root processing.
  • Adds shared regression coverage.
  • Verifies SQL Server generated SQL.

A captured string parameter can still be incorrectly wrapped as a primitive collection query root and needs equivalent handling and regression coverage.

File Summary
src/​EFCore/​Query/​QueryRootProcessor.cs Excludes literal strings from query-root conversion.
test/​EFCore.Specification.Tests/​Query/​AdHocMiscellaneousQueryTestBase.cs Adds string concatenation regression coverage.
test/​EFCore.SqlServer.FunctionalTests/​Query/​AdHocMiscellaneousQuerySqlServerTest.cs Verifies the generated SQL selects only the string column.

🧠 Review effort: Lite

Comment thread src/EFCore/Query/QueryRootProcessor.cs Resolved

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@AndriySvyryd
AndriySvyryd merged commit 419434f into dotnet:main Oct 16, 2026
19 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concat on string property Error

3 participants