79195046

Date: 2024-11-16 11:31:05
Score: 1.5
Natty:
Report link

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

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: mohamed naser