Skip to content

Fix WAL stats parse error on PG 18 (issue #132)#133

Merged
lesovsky merged 1 commit into
masterfrom
develop
May 18, 2026
Merged

Fix WAL stats parse error on PG 18 (issue #132)#133
lesovsky merged 1 commit into
masterfrom
develop

Conversation

@lesovsky
Copy link
Copy Markdown
Owner

Summary

  • SelectStatWALQuery now returns DiffIntvl as a third value (same pattern as SelectStatDatabaseGeneralQuery)
  • For PG 18, DiffIntvl = [2, 5]stats_age column (index 6, type interval) is excluded from numeric diff
  • For PG 14–17, DiffIntvl = [2, 9] unchanged
  • view.go: WAL case now applies the returned DiffIntvl

Root cause

PG 18 removed wal_write/wal_sync columns, shifting stats_age from index 10 to index 6. The old DiffIntvl = [2, 9] then included stats_age in the diff range. diffPair tried to parse '19 days 03:01:38' as an integer and failed.

Test plan

  • Test_diff_pg18_wal_stats_age — unit test that reproduces the bug with [2,9] and validates the fix with [2,5]
  • Test_SelectStatWALQuery — checks correct Ncols and DiffIntvl for all supported PG versions
  • Full test suite passes: go test ./...

Fixes #132

🤖 Generated with Claude Code

SelectStatWALQuery now returns DiffIntvl alongside query and column count.
For PG 18 the interval is [2,5] — excluding stats_age (col 6) which is a
PostgreSQL interval string and cannot be parsed as a numeric delta.
For PG 14-17 the interval remains [2,9].

view.go applies the returned DiffIntvl the same way databases_general does.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lesovsky lesovsky merged commit 1ebf907 into master May 18, 2026
1 check passed
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.

Parsing error in "Show WAL statistics"

1 participant