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

Translate Regex.IsMatch on SQLite #22497

Merged
merged 2 commits into from
Oct 30, 2020
Merged

Conversation

scomert
Copy link
Contributor

@scomert scomert commented Sep 11, 2020

implements #18845

@dnfadmin
Copy link

dnfadmin commented Sep 11, 2020

CLA assistant check
All CLA requirements met.

@bricelam bricelam changed the title implements #18845 Translate Regex.IsMatch on SQLite Sep 11, 2020
@smitpatel smitpatel changed the base branch from release/5.0-rc2 to main September 11, 2020 22:01
@smitpatel
Copy link
Member

Base branch change to main. Please rebase on latest main.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

One thing to be careful is the finer details of regex behavior. For example, in PostgreSQL the default is to have single-line behavior (where . doesn't match \n), while the .NET default behavior isn't. It may be OK to translate the default overload of IsMatch (the one without RegexOptions) to whatever the default behavior is on Sqlite, but it would mean a subtle behavior mismatch.

@roji
Copy link
Member

roji commented Sep 12, 2020

For comparison, here's the regex SQL generation in EFCore.PG (and here's the translation). In PG regex is a 1st-class operator instead of a function.

@bricelam
Copy link
Contributor

@roji The beauty here is that SQLite doesn't provide an implementation. (Well, outside of an optional extension that the user would need to compile themselves.) The idea being that you just re-use your platform's regex so the app and the database have the same semantics.

@roji
Copy link
Member

roji commented Sep 12, 2020

Ah, I see - so this would end up calling back into .NET Regex.IsMatch then? Or some native implementation?

Just asking the question around behavioral discrepancy between Regex.IsMatch and what actually gets executed..

@bricelam
Copy link
Contributor

Yes, the database would call back into Regex.IsMatch

@bricelam
Copy link
Contributor

Looks like we need to override the test in Cosmos too

@dougbu dougbu removed their request for review October 22, 2020 21:14
bricelam added a commit to scomert/efcore that referenced this pull request Oct 30, 2020
@bricelam
Copy link
Contributor

(Rebased, squashed, and cleaned it up a bit)

bricelam added a commit to scomert/efcore that referenced this pull request Oct 30, 2020
bricelam added a commit to scomert/efcore that referenced this pull request Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants