Fix scripts to handle postgresql versions based on ubuntu version