Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: runtime error for queries with row number paging projecting a constant #12570

Closed
maumar opened this issue Jul 5, 2018 · 2 comments
Closed
Labels
area-query closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-3.0 type-bug

Comments

@maumar
Copy link
Contributor

maumar commented Jul 5, 2018

query using Northwind model:

ctx.Customers.OrderBy(c => c.ContactName).Skip(5).Take(10).Select(e => "Foo").ToList();

Query plan:

(QueryContext queryContext) => IEnumerable<string> _InterceptExceptions(
|__ source: IEnumerable<string> _ShapedQuery(
|   |__ queryContext: queryContext, 
|   |__ shaperCommandContext: SelectExpression: 
|   |       SELECT [t].*
|   |       FROM (
|   |           SELECT [c].*, ROW_NUMBER() OVER(ORDER BY [c].[ContactName]) AS [__RowNumber__]
|   |           FROM [Customers] AS [c]
|   |       ) AS [t]
|   |       WHERE ([t].[__RowNumber__] > @__p_0) AND ([t].[__RowNumber__] <= (@__p_0 + @__p_1)), 
|   |__ shaper: (QueryContext queryContext | ValueBuffer c) => "Foo"), 
|__ contextType: TestModels.Northwind.NorthwindRelationalContext, 
|__ logger: DiagnosticsLogger<Query>, 
|__ queryContext: Unhandled parameter: queryContext)

exception:

System.InvalidOperationException : An exception occurred while reading a database value. The expected type was 'System.Int64' but the actual value was of type 'System.String'.
---- System.InvalidCastException : Specified cast is not valid.
	at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.ThrowReadValueException[TValue](Exception exception, Object value, IPropertyBase property)
	at lambda_method(Closure , DbDataReader )
	at Microsoft.EntityFrameworkCore.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader)
	at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
	at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
	at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
	at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
	at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
	at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
	at Microsoft.EntityFrameworkCore.Query.SimpleQueryTestBase`1.Skip_Take(Boolean isAsync)
	at Microsoft.EntityFrameworkCore.Query.RowNumberPagingTest.<>n__2(Boolean isAsync)
	at Microsoft.EntityFrameworkCore.Query.RowNumberPagingTest.<Skip_Take>d__4.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
	at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	--- End of stack trace from previous location where exception was thrown ---
	at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
	at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	--- End of stack trace from previous location where exception was thrown ---
	at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
	at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	----- Inner Stack Trace -----
	at System.Data.SqlClient.SqlBuffer.get_Int64()
	at System.Data.SqlClient.SqlDataReader.GetInt64(Int32 i)
	at lambda_method(Closure , DbDataReader )
@smitpatel
Copy link
Contributor

Blocked on #16400

@smitpatel
Copy link
Contributor

Rownumber paging has been removed.

@smitpatel smitpatel removed this from the Backlog milestone Nov 20, 2019
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-3.0 type-bug
Projects
None yet
Development

No branches or pull requests

4 participants