From 009a1f8795d6af7dd470fe02db06251fc2c26c87 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Wed, 1 Oct 2025 15:43:35 +0200 Subject: [PATCH] Simplify SQL when copying JSON scalar properties across documents Continues #3608 --- .../Query/Internal/NpgsqlQuerySqlGenerator.cs | 6 ++++-- ...yableMethodTranslatingExpressionVisitor.cs | 21 +++++++++++++++++++ .../Internal/Mapping/NpgsqlJsonTypeMapping.cs | 6 ++++-- .../ComplexJsonBulkUpdateNpgsqlTest.cs | 4 ++-- .../Types/Miscellaneous/NpgsqlBoolTypeTest.cs | 2 +- .../Types/Miscellaneous/NpgsqlGuidTypeTest.cs | 2 +- .../Miscellaneous/NpgsqlStringTypeTest.cs | 2 +- .../Types/Networking/NpgsqlInetTypeTest.cs | 2 +- .../Types/Networking/NpgsqlMacaddrTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlDecimalTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlDoubleTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlFloatTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlIntTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlLongTypeTest.cs | 2 +- .../Types/Numeric/NpgsqlShortTypeTest.cs | 2 +- .../Types/Temporal/NpgsqlDateOnlyTypeTest.cs | 2 +- .../Temporal/NpgsqlDateTimeOffsetTypeTest.cs | 2 +- .../NpgsqlDateTimeUnspecifiedTypeTest.cs | 2 +- .../Temporal/NpgsqlDateTimeUtcTypeTest.cs | 2 +- .../Types/Temporal/NpgsqlTimeOnlyTypeTest.cs | 2 +- .../Types/Temporal/NpgsqlTimeSpanTypeTest.cs | 2 +- 21 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs index 03b4a92bd..bc7e0380b 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs @@ -1092,8 +1092,10 @@ protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExp GenerateJsonPath(jsonScalarExpression.Json, returnsText: false, path); break; - // Scalar collection mapped to JSON (either because it's nested within a JSON document, or because the user explicitly - // opted for this rather than the default PG array mapping). + // A scalar to be extracted out as JSON (and not as e.g. text/int). + // This happens for scalar collection mapped to JSON (either because it's nested within a JSON document, + // or because the user explicitly opted for this rather than the default PG array mapping), or when we copy a scalar JSON + // property from one document to another via ExecuteUpdate. case NpgsqlJsonTypeMapping typeMapping: Check.DebugAssert(typeMapping.ElementTypeMapping is not null); GenerateJsonPath(jsonScalarExpression.Json, returnsText: false, path); diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs index 6b906bef2..9f0806a54 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs @@ -1301,6 +1301,27 @@ protected override bool TrySerializeScalarToJson( break; } + // We now have a scalar value expression that needs to be passed to jsonb_set(), but jsonb_set() requires a json/jsonb + // argument, not e.g. text or int. So we need to wrap the argument in to_jsonb/to_json. + // Note that for structural types we always already get a jsonb/json value and have already exited above (no need for + // to_jsonb/to_json). + + // One exception is if the value expression happens to be a JsonScalarExpression (e.g. copy scalar property from within + // one JSON document into another). For that case, rather than do to_jsonb(x.JsonbDoc ->> 'SomeProperty') - which extracts + // a jsonb property as text only to reconvert it back to jsonb - we just change the type mapping on the JsonScalarExpression + // to json/jsonb, in order to generate x.JsonbDoc -> 'SomeProperty' (no text extraction). + if (value is JsonScalarExpression jsonScalarValue + && jsonScalarValue.Json.TypeMapping?.StoreType == jsonTypeMapping.StoreType) + { + jsonValue = new JsonScalarExpression( + jsonScalarValue.Json, + jsonScalarValue.Path, + jsonScalarValue.Type, + jsonTypeMapping, + jsonScalarValue.IsNullable); + return true; + } + jsonValue = _sqlExpressionFactory.Function( jsonTypeMapping.StoreType switch { diff --git a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs index 76397a13c..151e088fc 100644 --- a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs +++ b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs @@ -5,9 +5,11 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping; /// -/// Supports the older Npgsql-specific JSON mapping, allowing mapping json/jsonb to text, to e.g. +/// Represents scalars within a JSON document that maintain their json/jsonb type (rather than being extracted out as e.g. text/int). +/// Also supports the older Npgsql-specific JSON mapping, allowing mapping json/jsonb to text, to e.g. /// (weakly-typed mapping) or to arbitrary POCOs (but without them being modeled). -/// For the standard EF JSON support, which relies on owned entity modeling, see . +/// Note that for structural types mapped via the standard EF complex/owned mapping, we use +/// . /// public class NpgsqlJsonTypeMapping : NpgsqlTypeMapping { diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs index 036179614..5112f1f79 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs @@ -364,7 +364,7 @@ public override async Task Update_multiple_properties_inside_associations_and_on UPDATE "RootEntity" AS r SET "Name" = r."Name" || 'Modified', - "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', to_jsonb(r."OptionalRelated" ->> 'String')), + "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', r."OptionalRelated" -> 'String'), "OptionalRelated" = jsonb_set(r."OptionalRelated", '{RequiredNested,String}', to_jsonb(@p)) WHERE (r."OptionalRelated") IS NOT NULL """); @@ -379,7 +379,7 @@ public override async Task Update_multiple_projected_associations_via_anonymous_ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', to_jsonb(r."OptionalRelated" ->> 'String')), +SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', r."OptionalRelated" -> 'String'), "OptionalRelated" = jsonb_set(r."OptionalRelated", '{String}', to_jsonb(@p)) WHERE (r."OptionalRelated") IS NOT NULL """); diff --git a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlBoolTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlBoolTypeTest.cs index 810990436..de95a3610 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlBoolTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlBoolTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS boolean))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlGuidTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlGuidTypeTest.cs index cd343be5f..057f204ee 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlGuidTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlGuidTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS uuid))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlStringTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlStringTypeTest.cs index 72f71c0d3..fca9ec380 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlStringTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Miscellaneous/NpgsqlStringTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(j."JsonContainer" ->> 'OtherValue')) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlInetTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlInetTypeTest.cs index b275ef366..cdedfcb3d 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlInetTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlInetTypeTest.cs @@ -82,7 +82,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS inet))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlMacaddrTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlMacaddrTypeTest.cs index 205ba79c8..3c1ade733 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlMacaddrTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Networking/NpgsqlMacaddrTypeTest.cs @@ -82,7 +82,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS macaddr))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDecimalTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDecimalTypeTest.cs index 575cbce6f..641d42d7b 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDecimalTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDecimalTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS numeric))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDoubleTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDoubleTypeTest.cs index 566c29a8c..3c9a2acb1 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDoubleTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlDoubleTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS double precision))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlFloatTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlFloatTypeTest.cs index 08b712a85..d5504e90e 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlFloatTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlFloatTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS real))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlIntTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlIntTypeTest.cs index 0aa9e5b11..482b86bc4 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlIntTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlIntTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS integer))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlLongTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlLongTypeTest.cs index 00b791c8f..921c4635f 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlLongTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlLongTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS bigint))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlShortTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlShortTypeTest.cs index 93f092bc8..e7c2f56ce 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlShortTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Numeric/NpgsqlShortTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS smallint))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateOnlyTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateOnlyTypeTest.cs index 28546743c..df22d978d 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateOnlyTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateOnlyTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS date))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeOffsetTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeOffsetTypeTest.cs index 7d9482dda..95ba4cc72 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeOffsetTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeOffsetTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS timestamp with time zone))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUnspecifiedTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUnspecifiedTypeTest.cs index 21814622b..57bc0c4ec 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUnspecifiedTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUnspecifiedTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS timestamp without time zone))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUtcTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUtcTypeTest.cs index af8ad588e..8f26b8942 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUtcTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlDateTimeUtcTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS timestamp with time zone))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeOnlyTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeOnlyTypeTest.cs index 87e7bea64..e3c978f92 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeOnlyTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeOnlyTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS time without time zone))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); } diff --git a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeSpanTypeTest.cs b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeSpanTypeTest.cs index 158aac4d3..3093cb533 100644 --- a/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeSpanTypeTest.cs +++ b/test/EFCore.PG.FunctionalTests/Types/Temporal/NpgsqlTimeSpanTypeTest.cs @@ -80,7 +80,7 @@ public override async Task ExecuteUpdate_within_json_to_another_json_property() AssertSql( """ UPDATE "JsonTypeEntity" AS j -SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', to_jsonb(CAST(j."JsonContainer" ->> 'OtherValue' AS interval))) +SET "JsonContainer" = jsonb_set(j."JsonContainer", '{Value}', j."JsonContainer" -> 'OtherValue') """); }