Skip to content
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

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

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jan 25, 2023

Ported from #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.

… for column 1 of 't'."

Problem was that in some cases (e.g. count over keyless entity that has been pushed down) we now generate empty projection in the subquery, where before we were projecting some columns.
SQL Server doesn't allow unaliased projection in the subquery, so the fix is to simply add an alias to the empty projection that we generate.

Fixes #29667
roji
roji previously approved these changes Jan 26, 2023
@rbhanda rbhanda added this to the 7.0.4 milestone Jan 26, 2023
@AndriySvyryd AndriySvyryd changed the base branch from main to release/7.0 January 26, 2023 18:22
@AndriySvyryd AndriySvyryd dismissed roji’s stale review January 26, 2023 18:22

The base branch was changed.

@ajcvickers
Copy link
Member

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

@dougbu dougbu merged commit c201f2a into release/7.0 Feb 7, 2023
@dougbu dougbu deleted the fix29667_70 branch February 7, 2023 22:31
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.

Count after Take throws "No column name was specified for column 1 of 't'."
6 participants