Fix queries in predb to work in both pgsql and mysql.