Skip to content

Commit

Permalink
Handle NULL for pg_stat_statements.query, fixes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Feb 25, 2020
1 parent b668560 commit c66edb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion collector/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func (c *collector) getStatements() {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

q := `SELECT userid, dbid, queryid, LEFT(query, $1), calls, total_time,
q := `SELECT userid, dbid, queryid, LEFT(COALESCE(query, ''), $1), calls, total_time,
min_time, max_time, stddev_time, rows, shared_blks_hit,
shared_blks_read, shared_blks_dirtied, shared_blks_written,
local_blks_hit, local_blks_read, local_blks_dirtied,
Expand Down

0 comments on commit c66edb8

Please sign in to comment.