I don't know how you are trying to upgrade, but it looks to me like postgres has not been shutdown & retarted on its own. The upgrade process is to shutdown alfresco completely (alfresco.sh stop), start postgres WITHOUT alfresco (I think that is alfresco.sh start postgres - but I am not sure of that). Then drop & restore the DB. Then shutdown postgres and then start alfresco