So, apparently this is a sql problem not django
you can't have an alias in the were statement.
probably the alias won't be evaluated in the where part of the query execution.
So, the db can't use a column it doesn't have and as a result they forbid it
does it mean the alias sql will be evaluated more than once? No, depending on the database optimization engine but most probably no, the only insufficient here is writing the same sql more than once but has no effect on the performance
also, if you don't care about the match value returned
use qs.alias() to prevent it from being written there as well