Upgrades failing

When I try to install the latest gitlab version, the update fails and it reports that I need to upgrade postgres.
When I run sudo gitlab-ctl pg-upgrade, it fails and the error in the log file is:
pg_dump: error: invalid column numbering in table “epic_user_mentions”

I can’t upgrade gitlab because pg-upgrade fails.
I can’t upgrade postgres because of the column numbering error.

I’m currently on GitLab Enterprise Edition v16.11