Use -> operator for SQLite JsonScalarExpression#30745
Merged
roji merged 1 commit intodotnet:mainfrom Apr 24, 2023
Merged
Conversation
roji
commented
Apr 23, 2023
| { | ||
| if (jsonScalarExpression.Path.Count == 1 | ||
| && jsonScalarExpression.Path[0].ToString() == "$") | ||
| // TODO: This trims the leading $ PathSegment, which isn't actually part of the path (but rather path of the JSONPATH language |
Member
Author
There was a problem hiding this comment.
@maumar note this - I think we should remove the $ path segment at the beginning, at the source... It's purely a SQL generation concern, and PostgreSQL would need to ignore it (since it doesn't use JSONPATH for this). Even for SQLite, when there's just a single (non-$) path segment, this PR does JsonColumn ->> 'Foo' (property) or JsonColumn ->> 1 (array), which is simpler and again doesn't need the $.
On a related note, when the JSON expression has no path segments, it shouldn't be created in translation - there's this piece of code here for ignoring/unwrapping it when it's empty.
Does that make sense? If so I can open a separate issue to do that.
maumar
approved these changes
Apr 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #30334