Upgrade to 17.0
The postgresql 17 was released 2 days ago. So here is quick manual to upgrade to latest version from 16.4.
pkg create postgresql16-server
mkdir /tmp/pg-upgrade
tar xf postgresql16-server-16.4.pkg -C /tmp/pg-upgrade
pkg delete -f databases/postgresql16-server databases/postgresql16-client
portmaster databases/postgresql17-server databases/postgresql17-client
su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data17 -U postgres"
su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data16/ -B /usr/local/bin/ -D /var/db/postgres/data17/ -U postgres"
service postgresql start
/usr/local/bin/vacuumdb -U postgres --all --analyze-in-stages
/var/db/postgres/delete_old_cluster.sh
Don't forget to check and rebuild all ports with dependency to postgresql-client
Full manual for general upgrades comes from here.