To a large degree I think this is a design problem in the query interpretation and the SQLFunction contract.
As there is no test attached, I will see if I can reproduce it.
This may wait until the SQM (new query parsing) work.