Skip to content

thenBy on optional column blows up #76

Closed
@psfblair

Description

@psfblair

The query expression:

    query { 
        for calendarEntry in dataContext.``[main].[calendar_entries]`` do
        where (calendarEntry.timestamp.Value >= todayTimestamp)
        sortBy calendarEntry.timestamp
        thenBy calendarEntry.title
        select calendarEntry  } |> Seq.toList

Note that both timestamp and title are optional columns.

The result:

Unhandled Exception: System.Exception: CreateQuery, e = value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlOrderedQueryable`1[FSharp.Data.Sql.Common.SqlEntity]).ThenBy(calendarEntry => calendarEntry.GetColumnOption("title"))
at FSharp.Data.Sql.Runtime.QueryImplementation+-cctor@112-1.Invoke (System.String message) [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[System.Linq.IQueryable].Finalize () [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.PrintfImpl+Final1@224[Microsoft.FSharp.Core.Unit,System.String,System.Linq.IQueryable,System.Linq.Expressions.Expression].Invoke (Microsoft.FSharp.Core.FSharpFunc`2 env, System.Linq.Expressions.Expression a) [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3028[System.Linq.Expressions.Expression,System.Linq.IQueryable,Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.PrintfImpl+PrintfEnv`3[Microsoft.FSharp.Core.Unit,System.String,System.Linq.IQueryable]]].Invoke (System.Linq.Expressions.Expression u) [0x00000] in <filename unknown>:0 
at FSharp.Data.Sql.Runtime.QueryImplementation+-cctor@111.System-Linq-IQueryProvider-CreateQuery (System.Linq.Expressions.Expression expression) [0x00000] in <filename unknown>:0 
at System.Linq.Queryable.ThenBy[SqlEntity,FSharpOption`1] (IOrderedQueryable`1 source, System.Linq.Expressions.Expression`1 keySelector) [0x00000] in <filename unknown>:0 
at (wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure,Microsoft.FSharp.Core.Unit)
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: CreateQuery, e = value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlOrderedQueryable`1[FSharp.Data.Sql.Common.SqlEntity]).ThenBy(calendarEntry => calendarEntry.GetColumnOption("title"))
at FSharp.Data.Sql.Runtime.QueryImplementation+-cctor@112-1.Invoke (System.String message) [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[System.Linq.IQueryable].Finalize () [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.PrintfImpl+Final1@224[Microsoft.FSharp.Core.Unit,System.String,System.Linq.IQueryable,System.Linq.Expressions.Expression].Invoke (Microsoft.FSharp.Core.FSharpFunc`2 env, System.Linq.Expressions.Expression a) [0x00000] in <filename unknown>:0 
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3028[System.Linq.Expressions.Expression,System.Linq.IQueryable,Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.PrintfImpl+PrintfEnv`3[Microsoft.FSharp.Core.Unit,System.String,System.Linq.IQueryable]]].Invoke (System.Linq.Expressions.Expression u) [0x00000] in <filename unknown>:0 
at FSharp.Data.Sql.Runtime.QueryImplementation+-cctor@111.System-Linq-IQueryProvider-CreateQuery (System.Linq.Expressions.Expression expression) [0x00000] in <filename unknown>:0 
at System.Linq.Queryable.ThenBy[SqlEntity,FSharpOption`1] (IOrderedQueryable`1 source, System.Linq.Expressions.Expression`1 keySelector) [0x00000] in <filename unknown>:0 
at (wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure,Microsoft.FSharp.Core.Unit)
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions