You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a recursive type and it seems to cause some issues. It was working OK until I added the is_initial_revision := .parent_revision is null; computed field...
EdgeDB Version: 5.2+ddd8aa4
EdgeDB CLI Version: 5.0.0+ef02158
OS Version: Windows 10
I'm trying to create a migration with this type in it:
type MyType {
parent_revision: MyType;
multi child_revisions :=.<parent_revision[is MyType];
is_latest_revision :=count(.child_revisions) =0;
is_initial_revision := .parent_revision is null;
}
When I try to create a migration, I get the following error:
edgedb error: InternalServerError: UnresolvedReferenceError: reference to an undefined item default::null in default::MyType@is_initial_revision
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler_pool/worker.py", line 178, in compile
units, cstate = COMPILER.compile_request(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/compiler.py", line 857, in compile_request
units, cstate = self.compile(
^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/compiler.py", line 937, in compile
unit_group = compile(ctx=ctx, source=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/compiler.py", line 2585, in compile
return _try_compile(ctx=ctx, source=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/compiler.py", line 2663, in _try_compile
comp, capabilities = _compile_dispatch_ql(
^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/compiler.py", line 2490, in _compile_dispatch_ql
query = ddl.compile_dispatch_ql_migration(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/ddl.py", line 386, in compile_dispatch_ql_migration
return _start_migration(ctx, ql, in_script)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/server/compiler/ddl.py", line 466, in _start_migration
target_schema = s_ddl.apply_sdl(
^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/schema/ddl.py", line 591, in apply_sdl
ddl_stmts = s_decl.sdl_to_ddl(target_schema, documents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/edgeql/declarative.py", line 471, in sdl_to_ddl
ordered = topological.sort(ddlgraph, allow_unresolved=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/common/topological.py", line 210, in sort
items = sort_ex(graph, allow_unresolved=allow_unresolved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edgedb/.local/share/edgedb/portable/5.2/lib/python3.12/site-packages/edb/common/topological.py", line 134, in sort_ex
raise UnresolvedReferenceError(
edb.common.topological.UnresolvedReferenceError: reference to an undefined item default::null in default::MyType@is_initial_revision
The text was updated successfully, but these errors were encountered:
Error presentation (ISE) is a bug, but the actual issue is that there is not a thing named null in EdgeDB. You want not exists .parent_revision instead.
The bug specifically seems to be in handling unresolved names in type expressions (which null is one of in ... is null, since E IS T checks if the LHS is of type T). If you write = null instead we produce a proper error message
Yury's idea of giving a hint about null is a good one
I'm using a recursive type and it seems to cause some issues. It was working OK until I added the
is_initial_revision := .parent_revision is null;
computed field...I'm trying to create a migration with this type in it:
When I try to create a migration, I get the following error:
The text was updated successfully, but these errors were encountered: