dotnet / dotnet/efcore

ModificationCommand.HandleJson hard-coded to send parameter with relational NULL for non-property partial update

Open
#32,191 0 comments 0 reactions 0 assignees View on GitHub
area-json area-save-changes
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

In ModificationCommand.HandleJson(), there's a path for partially updating a single property, and another for updating a JSON fragment. For the latter, if the fragment is being set to null, a column modification will be generated with a value of (relational) NULL ([code](https://github.com/dotnet/efcore/blob/main/src/EFCore.Relational/Update/ModificationCommand.cs#L783)). This assumes that the database-specific partial update function accepts relational NULL, which is not always the case (PostgreSQL jsonb_set() requires a JSON null instead, and propagates relational NULL like most SQL functions).

The entire HandleJson() function is private, not allowing providers to override the behavior,

/cc @maumar

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.