This is not great (especially if we start supporting delete or update smart sql).
But I can't think of a better way (short of actually parsing the query).