Skip to content

Read pg_stat_statements by its installed version, not the server's - #62

Merged
defkode merged 2 commits into
masterfrom
pg-stat-statements-extension-version
Oct 8, 2026
Merged

defkode merged 2 commits into
masterfrom
pg-stat-statements-extension-version

Conversation

@defkode

@defkode defkode commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Problem: On a server upgraded to PostgreSQL 17+ without running ALTER EXTENSION pg_stat_statements UPDATE, the queries pages crash with column "shared_blk_read_time" does not exist. The extension is still below 1.11, so it has the old column names, but pg_peek picked the SQL by server version.

Change:

  • The pg_stat_statements queries now pick their SQL by the installed extension version. Below 1.11 they use the PostgreSQL 16 queries. Added a test that recreates the extension at 1.10 on PG17+.
  • The overview header now shows when a newer extension version is available (pg_stat_statements 1.10 (1.11 available)), linking to the update command on the pg_stat_statements page. Before, that hint was only at the bottom of that page.

A server upgraded to PostgreSQL 17 without ALTER EXTENSION ... UPDATE keeps
pg_stat_statements below 1.11, whose columns are still blk_read_time and
blk_write_time. The PG17+ queries then failed with an undefined column.
The update hint only lived at the bottom of the pg_stat_statements page.
The overview header now says when a newer version is available and links
to it.
@defkode
defkode merged commit c52a341 into master Oct 8, 2026
6 checks passed
defkode added a commit that referenced this pull request Oct 8, 2026
pg_stat_statements is read by its installed version, not the server's:
a server upgraded to PostgreSQL 17+ without ALTER EXTENSION ... UPDATE
no longer crashes the queries pages (#62).
The overview header says when a newer pg_stat_statements is available,
linking to the update command (#62).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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