Check which entity each condition's field is on, before anything is read, and say whether the where clause has to be
evaluated per pair of a row and one of its joined rows:
the queried entity (workouts.date): written as the plain field (date), which is where the row holds it
the joined entity (read workouts.exercises on ..., exercises.name): per pair (see whereTree), so returns true
an entity merged into the rows or the joined rows (merge workouts.exercise_id with exercises._id): read from the
merged fields (exercises.name on the row), as before
anything else is an error: an entity that only links the join (exercise_muscle in workouts.muscles), or one
that isn't in the query at all (these used to match nothing, or fail to read the entity)
update and delete apply their conditions before any join or merge runs, so they only take the entity's own fields.
(An indexed joined-field condition used to be dropped once its index had narrowed the joined rows, so the command hit
every row the other conditions allowed: delete workouts.exercises on ... where exercises._id = 1 deleted every
workout. Refused since #79.)
Check which entity each condition's field is on, before anything is read, and say whether the where clause has to be evaluated per pair of a row and one of its joined rows:
workouts.date): written as the plain field (date), which is where the row holds itread workouts.exercises on ...,exercises.name): per pair (see whereTree), so returns truemerge workouts.exercise_id with exercises._id): read from the merged fields (exercises.nameon the row), as beforeexercise_muscleinworkouts.muscles), or one that isn't in the query at all (these used to match nothing, or fail to read the entity)update and delete apply their conditions before any join or merge runs, so they only take the entity's own fields. (An indexed joined-field condition used to be dropped once its index had narrowed the joined rows, so the command hit every row the other conditions allowed:
delete workouts.exercises on ... where exercises._id = 1deleted every workout. Refused since #79.)