edgedb / easy-edgedb

An illustrated textbook designed to be a one-stop shop for learning EdgeDB
https://www.edgedb.com/easy-edgedb
69 stars 36 forks source link

Chapter 5 code recap insertion error #85

Closed FelixDobler closed 1 year ago

FelixDobler commented 2 years ago

In the chapter5/code.md, the last insert

INSERT MinorVampire {
  name := 'Woman 1',
  master := (SELECT Vampire Filter .name = 'Count Dracula'),
};

generates the error

error: QueryError: possibly more than one element returned by an expression for a link 'master' declared as 'single'

due to the missing assert_single for the subquery as discussed in the Required links section of chapter 5.

Dhghomon commented 1 year ago

Thanks for raising the issue! Added a fix to this branch so will close now: https://github.com/edgedb/easy-edgedb/commit/3aa19233c11c599ff9262aab0d9116e66709a90e