Chapter 10: UnsupportedFeatureError in upsert example
krt-z opened this issue · 2 comments
INSERT City {
name := 'Munich',
population := 123456,
} UNLESS CONFLICT ON .name
ELSE (
UPDATE City
SET {
population := 123456,
}
);
This example leads to the following: error: UnsupportedFeatureError: UNLESS CONFLICT can not use ELSE when constraint is from a parent type
.
Not sure if it should be a different example, or if there is some way to express this in a supported way. The code for this error has a TODO saying it should be supported.
This really is an error in the schema for the chapter. EdgeDB currently does not support ON CONFLICT
clauses that depend on non-delegated
constraints defined in parent types, and Place
(which is a supertype of City
) defines its constraint without the delegated
keyword. This is also semantically incorrect as it prevents a Country
from having the same name as a City
.
Worked fine once I changed it to a delegated constraint, thanks.