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

Querybuilder For with selectInserted set to true throws InvalidOperationException #6

Closed
Syzuna opened this issue Oct 21, 2022 · 4 comments
Assignees

Comments

@Syzuna
Copy link

Syzuna commented Oct 21, 2022

Summary
When trying to do a bulk insert with a for and asking to select the inserted objects the query builder throws an InvalidOperationException because it cant wrap a global query.

Code

        return await QueryBuilder
            .For(factions, faction => QueryBuilder.Insert(faction, true))
            .ExecuteAsync(_edgeDb, token: cancellationToken);

Stacktrace

System.InvalidOperationException: Cannot wrap a global-defined query    at EdgeDB.QueryNodes.SelectNode.FinalizeQuery()    at EdgeDB.QueryNodes.ForNode.<FinalizeQuery>b__3_0(QueryNode x)    at System.Linq.Enumerable.SelectListIterator`2.MoveNext()    at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()    at System.Linq.Enumerable.Aggregate[TSource](IEnumerable`1 source, Func`3 func)    at EdgeDB.QueryNodes.ForNode.FinalizeQuery()    at EdgeDB.QueryBuilder`2.InternalBuild(Boolean includeGlobalsInQuery, Action`1 preFinalizerModifier)    at EdgeDB.QueryBuilder`2.IntrospectAndBuildAsync(IEdgeDBQueryable edgedb, CancellationToken token)    at EdgeDB.QueryBuilder`2.EdgeDB.Interfaces.IMultiCardinalityExecutable<TType>.ExecuteAsync(IEdgeDBQueryable edgedb, Nullable`1 capabilities, CancellationToken token)    at SyzunaPrograms.ED.EDCIA.DataImport.Data.Repositories.FactionRepository.InsertFactionsAsync(Faction[] factions, CancellationToken cancellationToken)

Original issue report in old archived repo: quinchs/EdgeDB.Net#33

@quinchs quinchs self-assigned this Nov 8, 2022
@quinchs
Copy link
Collaborator

quinchs commented Nov 8, 2022

Seems to be fixed in most recent version of the query builder, can you confirm @Syzuna?

@Syzuna
Copy link
Author

Syzuna commented Nov 8, 2022

Cannot retest bcs I ran into another issue now:

EdgeDB[10] Error occured while reading binary stream System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.    at EdgeDB.Binary.ClientPacketDuplexer.ReadExactAsync(Memory`1 buffer, CancellationToken token)    at EdgeDB.Binary.ClientPacketDuplexer.ReadAsync()

@quinchs
Copy link
Collaborator

quinchs commented Nov 8, 2022

That should be fixed in 1.0.1 of the driver and >=build 63 of the query builder

@Syzuna
Copy link
Author

Syzuna commented Nov 8, 2022

This seems fixed yeah

@Syzuna Syzuna closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants