Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixes and improvements to StartsWith/EndsWith/Contains#31482

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
roji merged 1 commit intodotnet:mainfromroji:StartsWith
Aug 16, 2023

Conversation

@roji
Copy link
Member

@rojiroji commentedAug 16, 2023
edited
Loading

  • Implement proper null semantics for LIKE:x LIKE y returns true iff x and y are non-null and there's a match; otherwise false (Null semantics compensation missing for LIKE negation #26735).
  • Remove exceptional behavior for StartsWith/EndsWith/Contains, so they now behave like any other function.
    • Switching to regular function null semantics means that these now receive compensation for 2-value logic just like any other function. Following the LIKE changes above, e.g.x.EndsWith(y) now returns true iff x and y are non-null and there's a match; otherwise false. This fixes negation issues such as"Where" clause with "!string.Contains" produces incorrect SQL #30493.
    • In addition, the case of an empty-string pattern - which in .NET returns true for any non-null string - now behaves consistently and returns false instead of true when the string being matched is null (this would throw in .NET).
  • Optimize StartsWith/EndsWith/Contains when the pattern is a parameter, by performing escaping on it via our runtime parameter rewriting facility.
    • This required moving translations for these methods out of the method translators and into SqlTranslatingExpressionVisitor (for access to RegisterRuntimeParameter). We should allow translators to access the query compilation context, at which point the code can move back.
    • This means we now do client-side rewriting of both constants and parameters - generating optimal LIKE SQL; the only case where we don't is when the pattern is a column.

@maumar you'll probably want to take a look at this when you're back.

Closes#30493
Closes#11881
Closes#26735
Does part of#26634 (for Like)

Copy link
Contributor

@ajcvickersajcvickers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

🐑 🇮🇹

@roji
Copy link
MemberAuthor

@maumar you're probably going to want to give this a look when you're back.

roji added a commit to roji/efcore that referenced this pull requestAug 17, 2023
roji added a commit that referenced this pull requestAug 17, 2023
This was referencedNov 24, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@ajcvickersajcvickersajcvickers approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

2 participants

@roji@ajcvickers

[8]ページ先頭

©2009-2025 Movatter.jp