And see also PostgreSQL 15 update.
Was it 4 years ago that you last upgraded?
Your OS is likely out of date too, so I’d probably recommend that you get a new VM and Move a Discourse site to another VPS with rsync, perhaps excluding postgres_*
, and then restoring a backup, that way you avoid the database upgrade and instead just restore your data and it’ll get migrated when you restore it.
It’s simpler, and if anything goes wrong, your existing site can keep limping along.