Confusing `modification of computed property` error message on repeated property on insert
- EdgeDB Version: 3.5 and 4.1+0c628ea
- EdgeDB CLI Version: 4.0.2+500be79
- OS Version: macos 13
Steps to Reproduce:
- Run the following (clearly wrong) query
insert Example {prop:=datetime_current(), prop:=datetime_current()};
error: QueryError: modification of computed property 'prop' of object type 'default::Example' is prohibited
┌─ <query>:1:43
│
1 │ insert Example {prop:=datetime_current(), prop:=datetime_current()};
│ ^^^^^^^^^^^^^^^^^^^^^^^^ error
Of course in this example it's easy to see what's wrong with the query, but in the much more complicated example we discovered this in, it was pretty bewildering. Also filing not just for UX but in case it is a hint of any more concerning underlying problem.
Schema:
type Example {
property prop: datetime;
}
I would like to see this say something about defining the computed property twice or maybe redefining the computed prop. Seems like that would be clearer. A couple of suggestions that might work:
redefining the computed property 'prop' of object type 'default::Example' is prohibitedyou may not define the computed property 'prop' of object type 'default::Example' more than once
I think I'd lean toward the latter option out of those two.
The big item is that this isn't a computed property at all. Just realized this is must just be how inserts are implemented, but suffice to say users don't think of the expressions they're assigning to properties in an insert as computed.
Perhaps it's coming up as computed because of the datetime_current function. However, it's also confusing to call it a "modification". The original query we noticed this in was an upsert which was extra confusing. I'm accustomed to minimizing the queries for bug reports but in this case that actually contributes to the central problem here which is the confusing nature of the message.
The big item is that this isn't a computed property at all.
Oh, right. This is an insert. 🤦♂️ Forget my suggestions then. Maybe this instead:
you may not assign the property 'prop' of object type 'default::Example' more than once
or something along those lines.
Another way this crops up: forgetting to not define a shape after turning a select into a with,
with gpt4users := (select
User {preferredFoundationModel: {provider_model_identifier}}
filter .preferredFoundationModel.provider_model_identifier like "gpt-4%"
),
update gpt4users set {
preferredFoundationModel := (select FoundationModel filter .provider_model_identifier = "gpt-4-turbo")
}