I'm curious about the error checking your doing wrt the select being an aggregate, etc. Do you even allow these constructs (i.e. GROUP BY, ORDER BY, WHERE, DISTINCT) in your syntax? Seems like the only part you really allow is which columns are being selected, no? Would you mind documenting this here?