Skip to content

GraphQL error when filer on field that exists in two or more more types #17261

Closed
@AndreySurkov

Description

@AndreySurkov

Describe the bug

When cteate two ContentTypes with field that named similar but with different type, GraphQL throws error when filter by this field.

GraphQL.Execution.UnhandledError: Error trying to resolve field 'numberType'.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: Text'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.<>c__DisplayClass44_0`2.<<ProduceAwaitedAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at YesSql.Data.WorkDispatcher`2.ScheduleAsync[TState](TKey key, TState state, Func`3 valueFactory)
   at YesSql.Store.ProduceAwaitedAsync[T,TState](WorkerQueryKey key, Func`3 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()\
   at OrchardCore.ContentManagement.GraphQL.Queries.ContentItemsFieldType.ResolveAsync(IResolveFieldContext context) in C:\\Repo\\GitHub\\OrchardCore\\src\\OrchardCore\\OrchardCore.ContentManagement.GraphQL\\Queries\\ContentItemsFieldType.cs:line 116
   at GraphQL.Resolvers.FuncFieldResolver`1.<>c__DisplayClass2_0.<<-ctor>b__0>d.MoveNext() in /_/src/GraphQL/Resolvers/FuncFieldResolver.cs:line 36
--- End of stack trace from previous location ---
   at GraphQL.Execution.ExecutionStrategy.ExecuteNodeAsync(ExecutionContext context, ExecutionNode node) in /_/src/GraphQL/Execution/ExecutionStrategy.cs:line 516
   --- End of inner exception stack trace ---"

Orchard Core version

2.1.0

To Reproduce

  1. Enable Content Fields Indexing (SQL) feature
  2. Create ContentType "NumberType"
    • Add Number Field wih name Value
  3. Create ContentType "StringType"
    • Add TExt Field wih name Value
  4. Go To GraphQL and run query
query MyQuery {
  numberType(where: {value: 123}) {
    value
  }
}

Logs and screenshots

When only "NumberType" created
image

When "NumberType" and "StringType" created
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions