Add more sanity checks to rlm_sql