Skip to content

Commit 672649f

Browse files
authored
Merge pull request #140 from blogh/fix_duration_mode_in_11+
Fix duration mode
2 parents ac31e50 + 4de3993 commit 672649f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: pgactivity/Data.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def pg_get_activities(self, duration_mode=1):
350350
ELSE pg_stat_activity.client_addr::TEXT
351351
END
352352
AS client,
353-
EXTRACT(epoch FROM (NOW() - pg_stat_activity.query_start)) AS duration,
353+
EXTRACT(epoch FROM (NOW() - pg_stat_activity.{duration_column})) AS duration,
354354
CASE WHEN pg_stat_activity.wait_event_type IN ('LWLock', 'Lock', 'BufferPin') THEN true ELSE false END AS wait,
355355
pg_stat_activity.usename AS user,
356356
pg_stat_activity.state AS state,
@@ -365,7 +365,7 @@ def pg_get_activities(self, duration_mode=1):
365365
ELSE extract(epoch from now() - {duration_column}) > %(min_duration)s
366366
END
367367
ORDER BY
368-
EXTRACT(epoch FROM (NOW() - pg_stat_activity.query_start)) DESC
368+
EXTRACT(epoch FROM (NOW() - pg_stat_activity.{duration_column})) DESC
369369
"""
370370
elif self.pg_num_version >= 100000:
371371
# PostgreSQL 10

0 commit comments

Comments
 (0)