efcore icon indicating copy to clipboard operation
efcore copied to clipboard

[release/7.0] Fix to #29667 - Count after Take throws "No column name was specified for column 1 of 't'."

Open maumar opened this issue 2 years ago • 1 comments

Ported from https://github.com/dotnet/efcore/pull/30134 Fixes #29667

Description

Query using keyless entities that also uses Take and Count throws SqlException.

Customer impact

Query using keyless entities that also uses Take and Count throws SqlException. Scenario is not common, but it is a regression and there is no good workaround for it. Only options are to not use keyless entities or perform Count on the client (which can be a significant perf hit)

How found

Customer report on 7.0.

Regression

Yes.

Testing

Added regression tests.

Risk

Low; Fix is very isolated, only affecting empty projection by adding an alias for it. Empty projection by definition can't be referenced in other parts of the query, so there is no risk of name clashes due to new alias. Also quirked.

maumar avatar Jan 25 '23 23:01 maumar

@maumar Make sure to change the PR to target the release/7.0 branch.

ajcvickers avatar Jan 26 '23 18:01 ajcvickers