edgedb-cli
edgedb-cli copied to clipboard
Introducing `required` tuple results in layered errors
- EdgeDB Version: 3.3
- EdgeDB CLI Version: 3.5.0+e1ad387
- OS Version: macos 13.5
Steps to Reproduce:
- Add required tuple property to a type
type Example {
required someTuple: tuple<a: str, b: str>;
}
- Migration produces the following prompt with strange
std|strsyntax
did you create property 'someTuple' of object type 'default::Example'? [y,n,l,c,b,s,q,?]
> y
Please specify an expression to populate existing objects in order to make property 'someTuple' of object type 'default::Example' required:
fill_expr> <tuple<a:std|str, b:std|str>>{}
- Change the set to be a tuple, error appears inline
fill_expr> <tuple<a:std|str, b:std|str>>(a:="a_", b:="b_")1:17: token "," is not allowed in expression (try parenthesize the expression)
- Add parens as suggested, different error
fill_expr> (<tuple<a:std|str, b:std|str>>(a:="a_", b:="b_"))
error: InvalidReferenceError: type 'default::std' does not exist
┌─ <statement>:3:22
│
3 │ SET REQUIRED USING ((<tuple<a:std|str, b:std|str>>(a:="a_", b:="b_")));
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean '.id'?
Rolling back last operation...
Workaround is to just put in the tuple directly. Filing for 1) the friction here and 2) in case it's a hint of a deeper CLI or compiler problem.
fill_expr> (a:="a_", b:="b_")
Just to chime in I had the same issue when removing a field from a named tuple:
Please specify a conversion expression to alter the type of property 'emoji':
cast_expr_2> <tuple<id:std|str, name:std|str, native:std|str>>.emoji
Rewrote to (.mytuple.id,.mytuple.name,.mytuple.native) to just rely on the fact that tuples are still ordered.
Also confirmed on 4.x (EdgeDB 4.2+833dd8d (repl 4.0.2+500be79))