Ported _new_dbh() to handle PostgreSQL connections