Skip to content

Comments

Introduce relational EF.Functions.JsonPathExists#37732

Merged
roji merged 1 commit intodotnet:mainfrom
roji:JsonPathExists
Feb 20, 2026
Merged

Introduce relational EF.Functions.JsonPathExists#37732
roji merged 1 commit intodotnet:mainfrom
roji:JsonPathExists

Conversation

@roji
Copy link
Member

@roji roji commented Feb 18, 2026

As part of syncing EFCore.PG, I noticed that the new EF.Functions.JsonExists introduced in #31136 (preview.2) conflicts with an existing function in EFCore.PG, which takes a key name (not a jsonpath). In addition, both the PG and SQL Server functions are actually called jsonb_path_exists()/JSON_PATH_EXISTS(), and including "path" in the name makes it more explicit that the argument represents a jsonpath rather than a simple property/key. The other databases also diverge quite widely around this, so while the capability exists everywhere, it's named differently.

So this PR renames EF.Function.JsonExists to JsonPathExists.

Database Function
PG jsonb_path_exists
SQL Server JSON_PATH_EXISTS (since SQL Server 2022)
SQLite json_type (returns NULL for non-existing path, as opposed to 'null' for JSON null values)
MariaDB JSON_EXISTS
MySQL JSON_CONTAINS_PATH
Oracle JSON_EXISTS

Part of #31136

@roji roji requested a review from a team as a code owner February 18, 2026 07:17
Copilot AI review requested due to automatic review settings February 18, 2026 07:17
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 renames the relational JSON path existence function from EF.Functions.JsonExists to EF.Functions.JsonPathExists to avoid name conflicts (notably with EFCore.PG) and to clarify that the argument is a JSONPath rather than a simple key.

Changes:

  • Renamed the public API RelationalDbFunctionsExtensions.JsonExists to JsonPathExists.
  • Updated SQL Server and SQLite translation visitors to recognize/translate the new method name.
  • Renamed/updated relational and provider functional tests to use JsonPathExists and updated expected SQL baselines.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/EFCore.Sqlite.FunctionalTests/Query/Translations/JsonTranslationsSqliteTest.cs Renames overridden test methods and base calls to JsonPathExists_* and keeps SQLite SQL assertions aligned.
test/EFCore.SqlServer.FunctionalTests/Query/Translations/JsonTranslationsSqlServerTest.cs Renames overridden test methods and base calls to JsonPathExists_* and keeps SQL Server SQL assertions aligned.
test/EFCore.Relational.Specification.Tests/Query/Translations/JsonTranslationsRelationalTestBase.cs Renames the relational JSON translation tests and updates LINQ to call EF.Functions.JsonPathExists.
src/EFCore.Sqlite.Core/Query/Internal/SqliteSqlTranslatingExpressionVisitor.cs Updates method-name dispatch to translate JsonPathExists.
src/EFCore.SqlServer/Query/Internal/SqlServerSqlTranslatingExpressionVisitor.cs Updates method-name dispatch to translate JsonPathExists.
src/EFCore.Relational/Extensions/RelationalDbFunctionsExtensions.cs Public API rename from JsonExists to JsonPathExists.

@roji roji linked an issue Feb 18, 2026 that may be closed by this pull request
@roji roji enabled auto-merge (squash) February 18, 2026 10:29
Copilot AI review requested due to automatic review settings February 18, 2026 11:12
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 8 out of 8 changed files in this pull request and generated no new comments.

@AndriySvyryd AndriySvyryd removed their assignment Feb 20, 2026
@roji roji disabled auto-merge February 20, 2026 06:53
@roji roji merged commit 56a682a into dotnet:main Feb 20, 2026
14 of 16 checks passed
@roji roji deleted the JsonPathExists branch February 20, 2026 06:54
@roji roji changed the title Rename JsonExists to JsonPathExists Introduce relational EF.Functions.JsonPathExists Feb 20, 2026
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.

Introduce relational EF.Functions.JsonPathExists

2 participants