Npgsql.NpgsqlException (0x80004005): Received backend message NoData while expecting ParseCompleteMessage. Please file a bug.
Hi,
We are getting this exception while calling the ExecuteSqlRaw method to enable connections for a template database. By default, our template database is restricted from being connected to, so we need to update its settings to enable connections first.
Thanks.
Version: .NET 9 Microsoft.EntityFrameworkCore 9.0.8 Npgsql 9.0.3 Npgsql.EntityFrameworkCore.PostgreSQL 9.0.4 PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Npgsql.NpgsqlException (0x80004005): Received backend message NoData while expecting ParseCompleteMessage. Please file a bug. at Npgsql.Util.Statics.ThrowIfMsgWrongType[T](IBackendMessage msg, NpgsqlConnector connector) at Npgsql.Util.Statics.Expect[T](IBackendMessage msg, NpgsqlConnector connector) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, Object[] parameters) ........ --- End of inner exception stack trace ---
var allowConnParam = new NpgsqlParameter<bool>("datallowconn", allowconn);
var databaseNameParam = new NpgsqlParameter<string>("datname", databaseName);
context.Database.**ExecuteSqlRaw**("update pg_database set datallowconn = @datallowconn where datname = @datname and @datallowconn <> datallowconn;",allowConnParam, databaseNameParam);
This is extremely weird. I tried with locally installed Postgres 15.1 and 17.0, and for both this query doesn't fail. Is is possible it's a bug for a specific postgres version? Could you confirm this?
This is extremely weird. I tried with locally installed Postgres 15.1 and 17.0, and for both this query doesn't fail. Is is possible it's a bug for a specific postgres version? Could you confirm this?
I am using the PostgreSQL Docker container version, but this doesn’t always happen.
PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit Docker Server Version: 28.5.1 Docker DeskTop Version: 28.5.1
I am using the PostgreSQL Docker container version, but this doesn’t always happen.
So, it's not stable? Is it possible for you to make a repro for me to take a look at?
I am using the PostgreSQL Docker container version, but this doesn’t always happen.
So, it's not stable? Is it possible for you to make a repro for me to take a look at?
Let me monitor this issue first. If I find steps to reproduce it, I will prepare a demo.