How to upgrade postgresql from V13 to V14 or V15

AFAIK there is no “upgrade” for Postgres - you need to dump/backup and restore into new version. Usually if there is braking change you will find upgrade procedures in the release notes of specific software version.

As this question is related to Postgres I think it better to ask this question at Postgres forum - likely you get better answers there.