Skip to content

PostgreSQL

18.4.0 (default), 17.10.0, 16.14.0, on port 15432.

Terminal window
rex service start postgres
rex db versions --set postgres 17.10.0

Major versions never share a data directory

Section titled “Major versions never share a data directory”

PostgreSQL major versions have mutually incompatible on-disk formats — a 17 server cannot read an 18 data directory, and pointing it at one is how people lose databases.

rexenv gives each major its own directory. Switching from 18 to 17 starts 17 with 17’s data, leaves 18’s alone, and does not attempt an in-place downgrade. Switch back and your 18 databases are where you left them.

Moving data across a major version is an explicit dump and restore, as it is everywhere else:

Terminal window
rex db export myapp.rex
rex db import myapp.rex dump.sql
host 127.0.0.1
port 15432

The site’s page shows its database name and credentials, and rex db browse opens Adminer connected to it.

Check your macOS version first — it is the answer more often than anything else:

Terminal window
sw_vers -productVersion

Below 26, PostgreSQL will not run and that is expected. rex doctor reports port conflicts and the rest.