[fix] Setting next auto increment value for postgres. Fixes #4408. Fixes #4684