Fixed #20788 -- exclude() generated subquery failure

"Fixed" by adding a test case, the original problem was already fixed
by earlier ORM changes. Thanks to david@judicata.com for the report
and test case.