From b2dd7bf9b591e0c32dfa2fafd13f26d90bf89a60 Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Thu, 24 Oct 2019 00:18:01 -0400 Subject: [PATCH] Use PERFORM within PL/pgSQL block to discard result --- src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs | 2 +- .../NpgsqlMigrationSqlGeneratorTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs b/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs index 4388af0c4..eb467fe96 100644 --- a/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs +++ b/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs @@ -389,7 +389,7 @@ protected override void Generate(AlterColumnOperation operation, IModel model, M .AppendLine($"ALTER SEQUENCE {sequence} RENAME TO {oldSequenceWithoutSchema};") .AppendLine($"ALTER TABLE {table} ALTER COLUMN {column} DROP DEFAULT;") .AppendLine($"ALTER TABLE {table} ALTER COLUMN {column} ADD GENERATED {identityTypeClause} AS IDENTITY;") - .AppendLine($"SELECT * FROM setval('{sequence}', nextval('{oldSequence}'), false);") + .AppendLine($"PERFORM setval('{sequence}', nextval('{oldSequence}'), false);") .AppendLine($"DROP SEQUENCE {oldSequence};"); break; default: diff --git a/test/EFCore.PG.FunctionalTests/NpgsqlMigrationSqlGeneratorTest.cs b/test/EFCore.PG.FunctionalTests/NpgsqlMigrationSqlGeneratorTest.cs index eb4135558..7f1e982ee 100644 --- a/test/EFCore.PG.FunctionalTests/NpgsqlMigrationSqlGeneratorTest.cs +++ b/test/EFCore.PG.FunctionalTests/NpgsqlMigrationSqlGeneratorTest.cs @@ -717,7 +717,7 @@ public void AlterColumnOperation_serial_to_identity() ALTER SEQUENCE ""People_Id_seq"" RENAME TO ""People_Id_old_seq""; ALTER TABLE ""People"" ALTER COLUMN ""Id"" DROP DEFAULT; ALTER TABLE ""People"" ALTER COLUMN ""Id"" ADD GENERATED ALWAYS AS IDENTITY; -SELECT * FROM setval('""People_Id_seq""', nextval('""People_Id_old_seq""'), false); +PERFORM setval('""People_Id_seq""', nextval('""People_Id_old_seq""'), false); DROP SEQUENCE ""People_Id_old_seq""; "); }