Better handling of havingRaw clause