Skip to content

Commit

Permalink
Add a special error message during test run when Postgres 14+ is usin…
Browse files Browse the repository at this point in the history
…g the older pgss (#472)

Add a special error message when Postgres 14+ is using the older version pg_stat_statements
  • Loading branch information
keiko713 authored Nov 21, 2023
1 parent c716bf1 commit fea04b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions input/postgres/statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ func GetStatements(ctx context.Context, server *state.Server, logger *util.Logge

if globalCollectionOpts.TestRun && foundExtMinorVersion < extMinorVersion {
logger.PrintInfo("pg_stat_statements extension outdated (1.%d installed, 1.%d available). To update run `ALTER EXTENSION pg_stat_statements UPDATE`", foundExtMinorVersion, extMinorVersion)
if extMinorVersion >= 9 {
// Using the older version pgss with Postgres 14+ can cause the incorrect query stats
// when track = all is used + there are toplevel queries and nested queries
// https://github.com/pganalyze/collector/pull/472#discussion_r1399976152
logger.PrintError("Outdated pg_stat_statements may cause incorrect query statistics")
}
}

usingStatsHelper := false
Expand Down

0 comments on commit fea04b2

Please sign in to comment.