升级到最新版本后出现502 Bad Gateway

Did you follow the advice in PostgreSQL 15 update? You might also vaccuum the database.