Skip to content

[8.0] Backport regex operand parentheses fix - #3930

Merged
roji merged 1 commit into
hotfix/8.0.12from
roji-regex-backport-8-0
Oct 4, 2026
Merged

roji merged 1 commit into
hotfix/8.0.12from
roji-regex-backport-8-0

Conversation

@roji

@roji roji commented Oct 4, 2026

Copy link
Copy Markdown
Member

Backports #3927 (b123371) to hotfix/8.0.12, addressing #3923 for EFCore.PG 8.0.

8.0 is affected: a JSON-derived regex pattern can concatenate the regex option prefix with the JSON document before extracting its property, producing invalid SQL behavior and PostgreSQL error 22P02.

  • Preserve the merged precedence-aware handling of both regex operands, the regex/concatenation precedence correction, and the CAST exception. Constant, column, and parameter patterns remain unchanged.
  • Preserve the six JSON-existence baseline parentheses introduced by the shared precedence helper.
  • Adapt conflict context to the 8.0 fixtures and negated SQL expectations to 8.0's existing NOT (... ~ ...) / NOT (... ~* ...) behavior; do not introduce the newer negation optimization. EF Core 8.0.11 already handles JsonScalarExpression, so the ToJson regression needs no additional provider changes.

Verification (.NET SDK 8.0.425, PostgreSQL 18.4): functional test project builds with zero warnings/errors; all 40 focused regex tests pass. Related JsonDomQueryTest, JsonPocoQueryTest, JsonQueryNpgsqlTest, NorthwindFunctionsQueryNpgsqlTest, FunkyDataQueryNpgsqlTest, OperatorsQueryNpgsqlTest, ArrayArrayQueryTest, ArrayListQueryTest, and FullTextSearchDbFunctionsNpgsqlTest suites pass: 1,616 passed, 17 skipped, zero failures.

No dependency or SDK manifest changes.

Fixes #3923

(cherry picked from commit b123371)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs
#	test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs
#	test/EFCore.PG.FunctionalTests/Query/JsonQueryNpgsqlTest.cs
#	test/EFCore.PG.FunctionalTests/Query/NorthwindFunctionsQueryNpgsqlTest.cs
@roji
roji merged commit 1d873bd into hotfix/8.0.12 Oct 4, 2026
9 of 12 checks passed
@roji
roji deleted the roji-regex-backport-8-0 branch October 4, 2026 10:15
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.

1 participant