Postgres-based checkpoint manager

Based on the API proposed by https://github.com/ipython/ipython/pull/7324.