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