edgedb-net
edgedb-net copied to clipboard
QueryBuilder For with Links throws EdgeDBErrorException
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>{}
}
)
Original report on archived repo: https://github.com/quinchs/EdgeDB.Net/issues/32
Does this still happen with the most recent version?
Cannot test if that issue is fixed or not. I run 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()
ok retested with correct version this time after myget finally updated. this still seems to be an issue yes.
EdgeDB[1] Failed to execute query InvalidReferenceError: object type or alias 'default::WGNYYHPYXYQQ_d1' does not exist
|
1 | for faction in json_array_unpack(<json>$XDSEOGGMJMGY) union (select (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 WGNYYHPYXYQQ_d1 offset <int64>json_get(faction, 'HomeStarSystem', 'WGNYYHPYXYQQ_depth_index') limit 1) if json_typeof(json_get(faction, 'HomeStarSystem')) != 'null' else <StarSystem>{} }) { name, eddb_id, is_player_faction, allegiance, government, home_star_system: { name, id64, eddb_id, coord_x, coord_y, coord_z, allegiance, government, economies, security, population, powers, power_state, active_states, system_controlling_faction: { name, eddb_id, is_player_faction, allegiance, government }, faction_presences: { ref_id, is_active, is_native }, stations: { name, type, market_id64, distance_to_arrival, max_landing_pad_size, allegiance, government, economies, services, active_states } } })
| ^^^^^^^^^^^^^^^
at EdgeDB.EdgeDBBinaryClient.ExecuteInternalAsync[TResult](String query, IDictionary`2 args, Nullable`1 cardinality, Nullable`1 capabilities, IOFormat format, Boolean isRetry, CancellationToken token)
Alright this FOR operator is cursed, will look into this soon