> No, the real issue is that you are referencing the outer table's column's > max() in the inner query (correlated sub-query).
Yeah. It's not easy to see how the software could guess your real intentions here. We could maybe offer a vaguely-worded HINT but I'm not able to think of wording that would be very helpful.
Can we do something like this in the code:
if( "level of the referenced column's relation" != "level of the (sub)query being processed" ) errhint( "The subquery may be unintentionally referencing an outer query's column!" );