Repository navigation
Closed
Milestone
Description
Steps to reproduce
Open connection at PostgreSQL 9.0 version.
The issue
When I open a connection in the PostgreSQL 9.0 version, Npgsql loads the enumeration information since version 8.3, but in the PostgresSQL 9.0 version the column 'enumsortorder' does not yet exist, as it is only available in the next version (9.1).
Exception message: 42703: column"enumsortorder" does not exists
Stack trace:
` at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 1032
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlDataReader.<NextResult>d__46.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 444
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlDataReader.NextResult() in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 340
at Npgsql.PostgresDatabaseInfo.<LoadBackendTypes>d__11.MoveNext() in C:\projects\npgsql\src\Npgsql\PostgresDatabaseInfo.cs:line 253
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.PostgresDatabaseInfo.<LoadPostgresInfo>d__3.MoveNext() in C:\projects\npgsql\src\Npgsql\PostgresDatabaseInfo.cs:line 72
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.PostgresDatabaseInfoFactory.<Load>d__0.MoveNext() in C:\projects\npgsql\src\Npgsql\PostgresDatabaseInfo.cs:line 43
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlDatabaseInfo.<Load>d__79.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlDatabaseInfo.cs:line 250
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnector.<LoadDatabaseInfo>d__150.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 466
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnector.<Open>d__149.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 455
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.ConnectorPool.<AllocateLong>d__19.MoveNext() in C:\projects\npgsql\src\Npgsql\ConnectorPool.cs:line 298
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:line 318
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnection.Open() in C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:line 153
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) in C:\projects\EFCore.PG\src\EFCore.PG\Storage\Internal\NpgsqlExecutionStrategy.cs:line 60
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__17`2.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at MicroSalesPainel.Negocio.ProgTerceirizadoNegocio.<GerarDados>d__4.MoveNext() in C:\Projeto\Painel\MicroSalesPainel.Negocio\ProgTerceirizadoNegocio.cs:line 65`
Further technical details
Npgsql version: 4.1.0
PostgreSQL version: 9.0.23
Operating system: Windows 10 x64
Other details about my project setup:
Metadata
Metadata
Assignees
Labels
No labels
Activity
austindrenski commentedon Jun 28, 2018
Similar to this,
9.0.23reached its end-of-life in September 2015.Were you previously using a version of Npgsql that doesn't break this?
evandrofuhr commentedon Jun 28, 2018
@austindrenski No, my application was raised recently to access a legacy database. I did test in previous versions of Ngpgsql but it inputs a lot of others bugs.
austindrenski commentedon Jun 28, 2018
It does seem like
{Npgsql,Posgres}DatabaseInfois set up to support this type of compatibility. except for theenumsortordercolumn.cc: @roji @Brar
npgsql/src/Npgsql/NpgsqlDatabaseInfo.cs
Lines 81 to 84 in 7f3a6af
npgsql/src/Npgsql/PostgresDatabaseInfo.cs
Lines 120 to 137 in 7f3a6af
roji commentedon Jun 29, 2018
If I'm not mistaken we didn't load the
enumsortorderattribute before 4.0. It should be pretty trivial to not sort by that column on pre-9.1 databases, so why not do it even if they're no longer officially supported...@Brar or @austindrenski, do you feel like adding this?
[-]Error on load Enum fields[/-][+]Can't load enums on PostgreSQL 9.0 or older[/+]austindrenski commentedon Jun 29, 2018
Sure, I'll look into a patch soon.
roji commentedon Jun 30, 2018
Merged and backported to 4.0.1, thanks @austindrenski!