use pool.query and handle errors