Okay, that does make some sense. However, it is strange that the execution context is different, I would expect it to be equivalent with the UI. 

Would be really great to document how the execution context differs. As mentioned I had the same issue with the CACHE statement. There might be more cases that are handled differently.