Comment lines in filter conditions

I just stumbled on a curious bug. I had a filter set for a table and a simple sort on one of the date columns in the table. But the sorting did not work.
I then reviewed the filter which had a comment line (starting with a #) to allow for quick editing of some filter paramenters. So the filter condition read like

a or b
# not c

and the column to be sorted was represented by

sort by xyz

in the SQL statement. The statement as a whole then read like

select abc, def from xyz where a or b # not c sort by xyz

which of course rendered the sorting criteria inefficient.
I doubt that I will stumble over this a 2nd time. But maybe the interface could check for this use case and issue a warning if there are comment lines in filters. Or insert a CRLF to the concatenation of filter and sort condition.