Skip to content

feat(pg_stat_monitor): upgrade from 2.1.0 to 2.4.0 - #2673

Open
Naeem-Akhter wants to merge 1 commit into
supabase:developfrom
Naeem-Akhter:pgsm-bump-2.4.0
Open

Naeem-Akhter wants to merge 1 commit into
supabase:developfrom
Naeem-Akhter:pgsm-bump-2.4.0

Conversation

@Naeem-Akhter

Copy link
Copy Markdown

What kind of change does this PR introduce?

  • upgrade pg_stat_monitor from v2.1.0 to v2.4.0 (PG 15 and 17; 1.0 and 2.1 remain available)

Additional context

Changes

  • nix/ext/versions.json: add pg_stat_monitor 2.4 (tag 2.4.0) for PG 15 and 17.
  • nix/ext/pg_stat_monitor.nix:
    • Older-version install fix. The non-latest branch unconditionally moved pg_stat_monitor--${version}.sql.in. The 2.1.0 tag doesn't ship that file (it has --2.0.sql plus upgrade scripts), so adding any version newer than 2.1 broke the build. The move is now conditional (still used for the 1.0.x tag). Older versions contribute only their library and control file, and the latest version provides all SQL scripts. The upgrade scripts shared by 2.1.0 and 2.4.0 differ only in formatting, with no change to objects or function attributes.
    • Build inputs. 2.4 includes libpq/libpq-be.h, which pulls in openssl/ssl.h and gssapi/gssapi.h for this Postgres build, so openssl and krb5 are added to buildInputs.
  • nix/tests/expected/z_{15,17,orioledb-17}_ext_interface.out: updated for the 2.4 interface:
    • pg_stat_monitor_internal gains OUT columns wal_buffers_full, parallel_workers_to_launch, parallel_workers_launched, generic_plan_calls, custom_plan_calls
    • removed: pgsm_create_11_view, pgsm_create_13_view, pgsm_create_view; added: pgsm_create_18_view, pgsm_create_19_view
    • The diff is mostly psql column re-padding. Please review with whitespace ignored (?w=1): the real change is about 10 lines per file.
  • ansible/vars.yml has no pg_stat_monitor entry and no migrations reference it, so neither needs a change.

User-facing note: per the 2.4.0 release notes, some pg_stat_monitor view columns report different values than 2.1 (e.g. plans now counts only actual planner invocations), so metrics may shift across the upgrade.

Testing (aarch64-darwin)

  • Extension builds: PG 15 (1.0, 2.1, 2.4) and PG 17 (2.1, 2.4).
  • nix flake check -L: all checks pass. One unrelated local-only flake: hstore_copy_binary failed once on macOS because a leftover /tmp/pg_regress_hstore_dup.bin was owned by another _nixbld user (no sandbox on darwin, so /tmp is shared). It passes after removing the file. Not applicable to Linux CI.
  • treefmt and pre-commit pass.

Not covered

  • Tested only on aarch64-darwin (Apple Silicon). x86_64-linux and aarch64-linux builds and checks are left to CI.
  • z_multigres-17_ext_interface.out and z_multigres-orioledb-17_ext_interface.out are not regenerated, because there is no aarch64-darwin check for these variants. I expect the same pg_stat_monitor-only changes and can update them from CI output.
  • Project pause/unpause backup testing and supa db-stats verification require Supabase infrastructure (see Action Items).

Observation (not changed in this PR). Running CREATE EXTENSION pg_stat_monitor VERSION '2.1' without first running switch_pg_stat_monitor_version 2.1 binds the functions to mixed libraries. The 2.0 install step uses the main control file, which points to the latest library, and the view then fails with "Must be loaded via shared_preload_libraries". The intended flow (switch first) avoids this. Happy to follow up with per-version install scripts generated from each tag if useful.

Action Items

  • New extension releases were Checked for any breaking changes
    • Reviewed release notes for 2.2.0, 2.3.x and 2.4.0. 2.4.0 breaking changes: drops PG 13 (not built here); removes pg_stat_monitor.pgsm_overflow_target (no-op since 2.0.0); pgsm_track_application_names now has no effect; several view columns report changed values (e.g. plans counts only actual planner invocations)
    • Neither parameter is set anywhere in this repo (ansible/, nix/, migrations/), so no config change is needed
    • Interface changes are captured in the updated ext_interface snapshots (new OUT columns on pg_stat_monitor_internal, PG 18/19 view helpers)
  • Extensions compatibility Checked (locally, PG 17)
    • CREATE → DROP → CREATE EXTENSION pg_stat_monitor: no errors in the server log
    • pg_stat_monitor_version() = 2.4.0; query tracked in the pg_stat_monitor view; pg_stat_monitor_reset() OK
    • Upgrade path: CREATE EXTENSION ... VERSION '2.1' → ALTER EXTENSION ... UPDATE → 2.4; view queryable afterwards
  • Backup and Restore Checked (local equivalent)
    • pg_dump -Fc → pg_restore into a new database with pg_stat_monitor enabled: extension 2.4 restored, data intact, view queryable, no log errors
    • The project pause/unpause and supa db-stats steps require Supabase infrastructure. I'd appreciate a maintainer running those.

@Naeem-Akhter
Naeem-Akhter requested a review from a team as a code owner November 15, 2026 16:37
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