Skip to content

A newer Postgres version

Peat runs Postgres 18 and 19. A new database takes the Platform’s default (computes.defaultPgVersion) unless you name one:

Terminal window
peat make orders --pg 19
Terminal window
peat move orders --pg 19

or raise spec.pgVersion on the Database. The database keeps its name, address and login.

A move is a copy, not an in-place upgrade. While it runs:

  1. A new copy on the newer version is started beside the old one.
  2. The door is shut for the length of the copy: new connections are refused and open sessions are ended. Plan for that.
  3. Everything is copied, then the two sides are compared: the databases, roles, settings, every kind of object, and every table’s row count.
  4. If they are equal, the name is pointed at the new copy and the door opens. If anything differs, nothing is switched, the door opens on the old version, and the status says what failed.

The old copy is kept, stopped, as orders-pg18 for keepOldFor (30 days by default).

Terminal window
peat move orders --pg 19 --rehearse

A rehearsal copies and compares every row with the door open, and switches nothing. It tells you whether the move would pass and how long the door would be shut (status.move.seconds on the Database). Run one before a real move of anything that matters.

peat move orders --pg 19 --verify full makes the real move compare every row as well, at the cost of a longer shut door.

Terminal window
peat move orders --retry # try a failed move again
peat move orders --back # return to the old version, while its copy is kept

Going back is refused when the database was written since the move, since those writes would be lost.

  • A version is never lowered except by --back.
  • A database with read replicas is not moved: delete them, move, make them again.
  • Replication slots are not carried over, and a subscription arrives disabled.
  • The full account, with what the comparison does and does not catch, is in the reference.