Chapter 6 Update Error
Closed this issue · 1 comments
smcmill2 commented
In Chapter 6 the UPDATE to Jonathan Harker
UPDATE Person FILTER .name = 'Jonathan Harker'
SET {
lover := assert_single(
(SELECT DETACHED Person FILTER .name = 'Mina Murray')
)
};
does not in fact yield an updated entry.
SELECT Person {
name,
lover: {
name
}
} FILTER .name = 'Jonathan Harker';
results in
[
{
"name": "Jonathan Harker",
"lover": null
}
]
I was however able to get it to correctly update by casting to Person as in the following.
SELECT (
UPDATE Person
FILTER .name = 'Jonathan Harker'
SET {
lover := <Person>(SELECT assert_single((SELECT DETACHED Person FILTER .name = 'Mina Murray')))
}
) {
name,
lover: {
name
}
}
which then yields.
[
{
"name": "Jonathan Harker",
"lover": {
"name": "Mina Murray"
}
}
]
I'm not sure whether this relates to this pull request or not, but may warrant updating the docs/code.
Dhghomon commented
Had a go through the schema + inserts today as they stand for the chapter and I see the updated entry as expected so will close the issue now.