Fix crash when ORDER BY clause contains non-field items. Add a test for it