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/3.1] Cosmos: Avoid using "value" as an alias #20574

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

AndriySvyryd
Copy link
Member

Fixes #20557

Description

EF generates aliases in the SQL query based on the projection properties. However "value" is a keyword in CosmosDB, so projections with a "Value" property result in invalid SQL.

Customer Impact

This is especially impactful when used with OData, as it generates this type of queries frequently and there's no workaround for the user.

How found

Reported by customer.

Test coverage

Added a test using this pattern.

Regression?

No.

Risk

Low. Fix only affects the alias used in the SQL.

@AndriySvyryd AndriySvyryd added this to the 3.1.x milestone Apr 9, 2020
@AndriySvyryd AndriySvyryd changed the base branch from master to release/3.1 April 9, 2020 01:37
@smitpatel
Copy link
Member

We should discuss with cosmos team to find a better solution.
Other keywords which fails in same way

  • Distinct
  • From
  • AS
  • Where
  • order by
  • group by
  • offset
  • limit

@smitpatel
Copy link
Member

May be we should generate SQL this way

SELECT VALUE { "Value" : c["OrderID"] }
FROM root c
WHERE (c["Discriminator"] = "Order")

Then we can probably avoid all clashes?

@AndriySvyryd
Copy link
Member Author

@smitpatel Sure, but that change would be risky for patch

@AndriySvyryd
Copy link
Member Author

Filed #20613

@AndriySvyryd AndriySvyryd merged commit ac768a3 into release/3.1 Apr 14, 2020
@AndriySvyryd AndriySvyryd deleted the Issue20557 branch April 14, 2020 04:07
@ajcvickers ajcvickers modified the milestones: 3.1.x, 3.1.4 Apr 14, 2020
@ajcvickers ajcvickers removed this from the 3.1.4 milestone Dec 11, 2020
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.

Cosmos: uniquify property alias if it's "value"
3 participants