From fb48afb5038d8370cce4298b33a3ed51888890e7 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Wed, 15 Feb 2023 09:34:09 +0100 Subject: [PATCH] Bump version to 7.0.3 --- Directory.Build.props | 4 +-- Directory.Packages.props | 4 +-- .../InheritanceBulkUpdatesNpgsqlTest.cs | 24 +++++++++++++++++ .../NonSharedModelBulkUpdatesNpgsqlTest.cs | 13 +++++++++- .../TPCInheritanceBulkUpdatesNpgsqlTest.cs | 24 ++++++++++++++++- .../TPTInheritanceBulkUpdatesNpgsqlTest.cs | 14 ++++++++++ .../Query/CitextQueryTest.cs | 4 +-- .../Update/StoredProcedureUpdateNpgsqlTest.cs | 26 +++++++++++++++++++ 8 files changed, 105 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0f8ce852b..11dc19232 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,9 +11,9 @@ true true - Copyright 2022 © The Npgsql Development Team + Copyright 2023 © The Npgsql Development Team Npgsql - 7.0.2 + 7.0.3 true PostgreSQL https://github.com/npgsql/efcore.pg diff --git a/Directory.Packages.props b/Directory.Packages.props index 922c8029e..24f17acf6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,8 +1,8 @@ - [7.0.1,8.0.0) + [7.0.3,8.0.0) 7.0.0 - 7.0.1 + 7.0.2 diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesNpgsqlTest.cs index de9f2fc54..8aa73a4c5 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesNpgsqlTest.cs @@ -206,6 +206,30 @@ public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool AssertExecuteUpdateSql(); } + public override async Task Update_with_interface_in_property_expression(bool async) + { + await base.Update_with_interface_in_property_expression(async); + + AssertExecuteUpdateSql( +""" +UPDATE "Drinks" AS d +SET "SugarGrams" = 0 +WHERE d."Discriminator" = 'Coke' +"""); + } + + public override async Task Update_with_interface_in_EF_Property_in_property_expression(bool async) + { + await base.Update_with_interface_in_EF_Property_in_property_expression(async); + + AssertExecuteUpdateSql( +""" +UPDATE "Drinks" AS d +SET "SugarGrams" = 0 +WHERE d."Discriminator" = 'Coke' +"""); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesNpgsqlTest.cs index bc88b2407..59acf15b2 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesNpgsqlTest.cs @@ -6,7 +6,7 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Update; -public class NonSharedModelBulkUpdatesSqlServerTest : NonSharedModelBulkUpdatesTestBase +public class NonSharedModelBulkUpdatesNpgsqlTest : NonSharedModelBulkUpdatesTestBase { protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance; @@ -41,6 +41,17 @@ public override async Task Delete_aggregate_root_when_table_sharing_with_non_own AssertSql(); } + public override async Task Update_non_owned_property_on_entity_with_owned(bool async) + { + await base.Update_non_owned_property_on_entity_with_owned(async); + + AssertSql( +""" +UPDATE "Owner" AS o +SET "Title" = 'SomeValue' +"""); + } + public override async Task Delete_predicate_based_on_optional_navigation(bool async) { await base.Delete_predicate_based_on_optional_navigation(async); diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesNpgsqlTest.cs index 94b13c813..97061ae80 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesNpgsqlTest.cs @@ -11,7 +11,7 @@ public TPCInheritanceBulkUpdatesNpgsqlTest( : base(fixture) { ClearLog(); - // Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } public override async Task Delete_where_hierarchy(bool async) @@ -176,6 +176,28 @@ public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool AssertExecuteUpdateSql(); } + public override async Task Update_with_interface_in_property_expression(bool async) + { + await base.Update_with_interface_in_property_expression(async); + + AssertExecuteUpdateSql( +""" +UPDATE "Coke" AS c +SET "SugarGrams" = 0 +"""); + } + + public override async Task Update_with_interface_in_EF_Property_in_property_expression(bool async) + { + await base.Update_with_interface_in_EF_Property_in_property_expression(async); + + AssertExecuteUpdateSql( +""" +UPDATE "Coke" AS c +SET "SugarGrams" = 0 +"""); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesNpgsqlTest.cs index 94e28f0ab..995853579 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesNpgsqlTest.cs @@ -140,6 +140,20 @@ public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool AssertExecuteUpdateSql(); } + public override async Task Update_with_interface_in_property_expression(bool async) + { + await base.Update_with_interface_in_property_expression(async); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_with_interface_in_EF_Property_in_property_expression(bool async) + { + await base.Update_with_interface_in_EF_Property_in_property_expression(async); + + AssertExecuteUpdateSql(); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.PG.FunctionalTests/Query/CitextQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/CitextQueryTest.cs index f09b24aa8..fa91c52a6 100644 --- a/test/EFCore.PG.FunctionalTests/Query/CitextQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/CitextQueryTest.cs @@ -49,7 +49,7 @@ public void StartsWith_param_pattern() SELECT s."Id", s."CaseInsensitiveText" FROM "SomeEntities" AS s -WHERE @__param_0 = '' OR ((s."CaseInsensitiveText" IS NOT NULL) AND (s."CaseInsensitiveText" LIKE @__param_0_1 || '%' ESCAPE '') AND left(s."CaseInsensitiveText", length(@__param_0))::citext = @__param_0::citext) +WHERE @__param_0 = '' OR ((s."CaseInsensitiveText" IS NOT NULL) AND (s."CaseInsensitiveText" LIKE @__param_0_1 || '%' ESCAPE '') AND left(s."CaseInsensitiveText", length(@__param_0_1))::citext = @__param_0_1::citext) LIMIT 2 """); } @@ -104,7 +104,7 @@ public void EndsWith_param_pattern() SELECT s."Id", s."CaseInsensitiveText" FROM "SomeEntities" AS s -WHERE @__param_0 = '' OR ((s."CaseInsensitiveText" IS NOT NULL) AND right(s."CaseInsensitiveText", length(@__param_0_1))::citext = @__param_0::citext) +WHERE @__param_0 = '' OR ((s."CaseInsensitiveText" IS NOT NULL) AND right(s."CaseInsensitiveText", length(@__param_0_1))::citext = @__param_0_1::citext) LIMIT 2 """); } diff --git a/test/EFCore.PG.FunctionalTests/Update/StoredProcedureUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Update/StoredProcedureUpdateNpgsqlTest.cs index 8de07e06d..a4e4d6aeb 100644 --- a/test/EFCore.PG.FunctionalTests/Update/StoredProcedureUpdateNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Update/StoredProcedureUpdateNpgsqlTest.cs @@ -528,6 +528,32 @@ await base.Tpc( """); } + public override async Task Non_sproc_followed_by_sproc_commands_in_the_same_batch(bool async) + { + await base.Non_sproc_followed_by_sproc_commands_in_the_same_batch( + async, +""" +CREATE PROCEDURE "EntityWithAdditionalProperty_Insert"(name text, OUT id int, additional_property int) LANGUAGE plpgsql AS $$ +BEGIN + INSERT INTO "EntityWithAdditionalProperty" ("Name", "AdditionalProperty") VALUES (name, additional_property) RETURNING "Id" INTO id; +END $$ +"""); + + AssertSql( +""" +@p2='1' +@p0='2' +@p3='1' +@p1='Entity1_Modified' +@p4='Entity2' +@p5='0' + +UPDATE "EntityWithAdditionalProperty" SET "AdditionalProperty" = @p0, "Name" = @p1 +WHERE "Id" = @p2 AND "AdditionalProperty" = @p3; +CALL "EntityWithAdditionalProperty_Insert"(@p4, NULL, @p5); +"""); + } + protected override void ConfigureStoreGeneratedConcurrencyToken(EntityTypeBuilder entityTypeBuilder, string propertyName) => entityTypeBuilder.Property(propertyName) .HasColumnName("xmin")