Npgsql is the .NET data provider for Postgresql. It allows any program developed for .NET framework to access a Postgresql database server. It is implemented in 100% C# code. Postgresql versions since 9.0 are officially supported, others may work.
Hi! I'm using EF.Core + Npgsql 3.1.4 and got this error recently:
Npgsql.NpgsqlException (0x80004005): Unknown message code: 47
at Npgsql.Util.PGUtil.ValidateBackendMessageCode(BackendMessageCode code)
at Npgsql.NpgsqlConnector.<>cDisplayClass160_0.<<DoReadMessage>gReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnector.<>cDisplayClass160_0.<<DoReadMessage>gReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func
4 operation, Func4 verifySucceeded, TState state, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func
4 operation, Func4 verifySucceeded, TState state, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable
1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsyncTSource
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsyncTSource
at A
After this error is thrown other queries just hang when awaited.
Please help me how to fix it? Thanks!
I'm looking at the source and see an enum called PostgresExpressionType.AtTimeZone
and am wondering if this can be used. For example i have a type.
public class Example
{
public DateTimeOffset SomeDate {get; set;}
public string IanaTimeZone {get; set;}
}
i'd like to write a query as follows_context.Example.Where(x=> x.SomeDate.AtTimeZone(x.IanaTimeZone).DayOfWeek == DayOfWeek.Monday
Hi Guys,
Got a question. I have a column having type astext[]
, while storing data I am facing no problem. but while querying its not returning anything. e.g.var query = dbContext.Users.Where(x=>x.Aliases.Contains("somevalue")).Select(a=>a);
Solved!! Upgraded to 5.0.0-rc1
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL --version 5.0.0-rc1
Thanks @AlbertoPa for your time :)