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

Json: predicate on json bool property generates incorrect sql #29572

Closed
maumar opened this issue Nov 15, 2022 · 3 comments · Fixed by #29574
Closed

Json: predicate on json bool property generates incorrect sql #29572

maumar opened this issue Nov 15, 2022 · 3 comments · Fixed by #29574
Assignees
Labels
area-json area-query area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Nov 15, 2022

ss.Set<JsonEntityAllTypes>().Where(x => !x.Reference.TestBoolean)

produces:

SELECT [j].[Id], [j].[Collection], [j].[Reference]
FROM [JsonEntitiesAllTypes] AS [j]
WHERE NOT (CAST(JSON_VALUE([j].[Reference],'$.TestBoolean') AS bit))

problem is search condition visitor doesn't correctly process json bool properties

@maumar maumar self-assigned this Nov 15, 2022
@maumar maumar added this to the 8.0.0 milestone Nov 15, 2022
maumar added a commit that referenced this issue Nov 15, 2022
…rect sql

Search condition visitor wasn't handling json scalar expressions properly - we should convert them into search conditions/values just like we do with regular columns

Fixes #29572
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Nov 15, 2022
@ghost ghost closed this as completed in #29574 Nov 16, 2022
ghost pushed a commit that referenced this issue Nov 16, 2022
…rect sql (#29574)

Search condition visitor wasn't handling json scalar expressions properly - we should convert them into search conditions/values just like we do with regular columns

Fixes #29572
@roji
Copy link
Member

roji commented Nov 16, 2022

Reopening to consider patching this for 7.0.

@roji roji reopened this Nov 16, 2022
@roji roji removed this from the 8.0.0 milestone Nov 16, 2022
@ajcvickers
Copy link
Member

Note from triage: we could consider patching this if we get a lot of customer reports. Workaround is to use ss.Set<JsonEntityAllTypes>().Where(x => x.Reference.TestBoolean == false)

@ajcvickers ajcvickers reopened this Jul 8, 2023
@ajcvickers
Copy link
Member

@maumar Let's create the patch PR for this.

maumar added a commit that referenced this issue Jul 14, 2023
…rect sql

Search condition visitor wasn't handling json scalar expressions properly - we should convert them into search conditions/values just like we do with regular columns

Fixes #29572
@ajcvickers ajcvickers modified the milestones: 7.0.x, 7.0.12, 7.0.11 Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-json area-query area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants