id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 9192 exclude() fails; generates query using bad table alias Brent Hagany nobody "The ORM generates a query that attempts to use a table alias (U1) that it did not create, when performing joins across multiple (at least 3) models that are related as in the attachment. The invalid query generated is: 'SELECT `exclude_modeltwo`.`id`, `exclude_modeltwo`.`model_one_id` FROM `exclude_modeltwo` WHERE NOT (`exclude_modeltwo`.`model_one_id` IN (SELECT U2.`model_one_id` FROM `exclude_modeltwo` U0 INNER JOIN `exclude_modelthree` U2 ON (U1.`id` = U2.`model_one_id`) WHERE U2.`id` = %s ))'" closed Database layer (models, ORM) 1.0 duplicate exclude filter alias brent.hagany@… Unreviewed 0 0 0 0 0 0