Skip to content

Implement EF.Function.JsonPathExists#3770

Merged
roji merged 1 commit intonpgsql:mainfrom
roji:Json
Mar 6, 2026
Merged

Implement EF.Function.JsonPathExists#3770
roji merged 1 commit intonpgsql:mainfrom
roji:Json

Conversation

@roji
Copy link
Member

@roji roji commented Mar 5, 2026

Closes #3733

Copilot AI review requested due to automatic review settings March 5, 2026 21:55
@roji roji enabled auto-merge (squash) March 5, 2026 21:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements support for EF.Functions.JsonPathExists() in the Npgsql EF Core provider. The new EF Core API (RelationalDbFunctionsExtensions.JsonPathExists) is translated to the PostgreSQL JSON_EXISTS() SQL function (a SQL/JSON standard function introduced in PostgreSQL 16), with special handling for scalar string columns, complex JSON properties, and owned JSON entities.

Changes:

  • Added translation of EF.Functions.JsonPathExists() to JSON_EXISTS() SQL in the visitor, with pattern matching for different JSON argument shapes (scalar, complex, owned entity)
  • Updated three placeholder tests from AssertTranslationFailed to actual SQL assertions verifying the JSON_EXISTS(...) output
  • Simplified three existing test call sites by using the extension method syntax (EF.Functions.JsonExists(...)) instead of the fully qualified static call

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs Core implementation: new switch case translates EF.Functions.JsonPathExists() to the SQL JSON_EXISTS() function
test/EFCore.PG.FunctionalTests/Query/Translations/JsonTranslationsNpgsqlTest.cs Replaces AssertTranslationFailed stubs with actual SQL assertions for the three JsonPathExists test variants
test/EFCore.PG.FunctionalTests/Query/JsonStringQueryTest.cs Style cleanup: uses extension method syntax for JsonExists call
test/EFCore.PG.FunctionalTests/Query/JsonPocoQueryTest.cs Style cleanup: uses extension method syntax for JsonExists call
test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs Style cleanup: uses extension method syntax for JsonExists call

You can also share your feedback on Copilot code review. Take the survey.

@roji roji disabled auto-merge March 5, 2026 22:06
@roji roji enabled auto-merge (squash) March 6, 2026 08:36
Copilot AI review requested due to automatic review settings March 6, 2026 09:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@roji roji merged commit 716994b into npgsql:main Mar 6, 2026
14 checks passed
@roji roji deleted the Json branch March 6, 2026 09:39
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.

Translate the new EF.Functions.JsonPathExists()

2 participants