Skip to content

Allow Postgres 18 in fly mpg create and default to 17 - #5445

Open
tripledoublev wants to merge 2 commits into
masterfrom
vincent/mpg-create-pg18
Open

tripledoublev wants to merge 2 commits into
masterfrom
vincent/mpg-create-pg18

Conversation

@tripledoublev

@tripledoublev tripledoublev commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Change Summary

What and Why:

The dashboard lets you create a Managed Postgres cluster on Postgres 16, 17 or 18, and defaults to 17. fly mpg create rejected 18 and defaulted to 16:

$ fly mpg create --pg-major-version 18 ...
Error: invalid Postgres major version: 18. Supported versions are 16 and 17

The check is client-side only. With it relaxed, the platform creates the cluster. This closes the gap between the CLI and the dashboard:

  • --pg-major-version accepts 16, 17 and 18.
  • The default is 17, for fly mpg create and for the cluster fly launch creates.
  • The help and the error message list all three versions.

For reviewers: the default change is the part to weigh. Anyone running fly mpg create or fly launch without --pg-major-version now gets 17 instead of 16. If you'd rather keep 16 as the CLI default, that is a one-line revert of DefaultPGMajorVersion; accepting 18 stands on its own.

Postgres 18 is now available to all organizations.

How:

  • internal/mpgutil now holds DefaultPGMajorVersion (an int), the list of supported versions, SupportedPGMajorVersionsText and ValidatePGMajorVersion. fly mpg create uses them for the flag default and the check, and fly launch uses the same default.
  • The two version tests in mpg_test.go rebuilt the != 16 && != 17 condition inside the test, so they passed whatever the command did. They now call ValidatePGMajorVersion and check the create flag's default and help text.

Testing:

  • New tests run the real fly mpg create against mock APIs (no flag sends 17; 16, 17 and 18 are sent as given; 15, 19 and 0 are rejected before any request) and check the request fly launch builds. Hard-coding 16 in launch, or ignoring the validation error in create, fails them.
  • go build ./..., go vet and go test pass for internal/command/mpg/..., internal/mpgutil/... and internal/command/launch/.... golangci-lint v2.15.0 reports 0 issues on those packages.
  • With the built binary, against production: fly mpg create with no version flag created a cluster on 17.11; --pg-major-version 18 created one on 18.6; 15 and 19 are rejected with the new message. Both clusters were destroyed afterwards.
  • On the 18 cluster, fly mpg connect -c, -f and -f - work, and a pg_dump 18 file restores.
  • Not run: fly launch end to end (it shares the constant; unit tests pass), PostGIS on 18 (--enable-postgis-support), Windows or macOS.

Found while testing superfly/docs#2647.

Note: the API itself still defaults to 16 when no version is sent, so flyctl keeps sending one.


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

The generated fly mpg create page picks up the new help text after release. Hand-written pages that say "Postgres 16 and 17" need a follow-up in superfly/docs: postgres/extensions.mdx and postgres/index.mdx.

🤖 Generated with Claude Code

tripledoublev and others added 2 commits November 12, 2026 19:08
The dashboard offers Postgres 16, 17 and 18 for new Managed Postgres
clusters and defaults to 17. fly mpg create rejected 18 and defaulted
to 16. Accept 18, default to 17 for fly mpg create and fly launch, and
keep the supported list in one place.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Cover the wiring, not only the validator: fly mpg create sends the
default or the requested version and rejects others before any request,
and fly launch sends the default. Build the supported-versions text
from the list so help and errors cannot drift from it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant