QueryBuilder For with Links throws EdgeDBErrorException
Syzuna opened this issue · comments
Syzuna commented
Summary
When trying to do a bulk insert with a for the query builder creates a faulty query that results in an EdgeDBErrorException.
Code
return await QueryBuilder
.For(factions, faction => QueryBuilder.Insert(faction, false))
.ExecuteAsync(_edgeDb, token: cancellationToken);
Stacktrace
EdgeDB[1] Failed to execute query EdgeDB.EdgeDBErrorException: object type or alias 'default::TLIZEJSNTVCU_d1' does not exist at EdgeDB.EdgeDBBinaryClient.<>c__DisplayClass49_1.<ExecuteInternalAsync>g__parseHandlerPredicate|2(IReceiveable packet) at EdgeDB.ClientPacketDuplexer.<>c__DisplayClass31_0.<NextAsync>b__0(IReceiveable t) --- End of stack trace from previous location --- at EdgeDB.ClientPacketDuplexer.NextAsync(Predicate`1 predicate, Boolean alwaysReturnError, CancellationToken token) at EdgeDB.ClientPacketDuplexer.DuplexAsync(Predicate`1 predicate, Boolean alwaysReturnError, CancellationToken token, Sendable[] packets) at EdgeDB.EdgeDBBinaryClient.ExecuteInternalAsync(String query, IDictionary`2 args, Nullable`1 cardinality, Nullable`1 capabilities, IOFormat format, Boolean isRetry, CancellationToken token)
Generated Query
for faction in json_array_unpack(
<json>$YAZBVRJPGFFH
)
union (
insert Faction {
name := <str>json_get(
faction,
'Name'
),
is_player_faction := <bool>json_get(
faction,
'IsPlayerFaction'
),
allegiance := <str>json_get(
faction,
'Allegiance'
),
government := <str>json_get(
faction,
'Government'
),
home_star_system := (
select TLIZEJSNTVCU_d1 offset <int64>json_get(
faction,
'HomeStarSystem',
'TLIZEJSNTVCU_depth_index'
)
limit 1
)
if json_typeof(
json_get(
faction,
'HomeStarSystem'
)
)
!= 'null' else <StarSystem>{}
}
)