Assigning to a required link on an update does not work when coalescing with the existing link
- Dominant language
- Python
- Stars
- 14.2k
- Forks
- 450
- PR merge metrics
- No merged PRs in 30d
Description
Schema:
```esdl
type User {}
type Session {
required expires: datetime;
required user: User;
}
```
Given the following query:
```edgeql
with
user_id := $user_id,
user := (select User filter .id = user_id),
expires := $expires,
session := $session_id,
update session set {
expires := expires ?? .expires,
user := user ?? .user,
};
```
This gives an error:
```
MissingRequiredError: missing value for required link 'user' of object type 'default::Session'v
```
But this does not give an error:
```edgeql
user := assert_exists(user ?? .user),
```
---
Notice that `expires` (which is a required _property_) does not seem to have an issue inferring that the coalesce expression is `AT_LEAST_ONE`, but for the required `user` _link_, it requires wrapping with `assert_exists`.
Contributor guide
Assessment
This issue has not been assessed yet.