Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/commands/pg/ps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export default class Ps extends Command {
FROM pg_stat_activity
WHERE query <> '<insufficient privilege>'${verbose ? '' : " AND state <> 'idle'"}
AND pid <> pg_backend_pid()
AND NOT (
state = 'idle in transaction'
AND usename = 'postgres'
AND query LIKE '%pg_backup_start%'
)
ORDER BY query_start DESC
`)
const output = await psqlService.execQuery(query)
Expand Down
10 changes: 10 additions & 0 deletions test/unit/commands/pg/ps.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ SELECT pid,
FROM pg_stat_activity
WHERE query <> '<insufficient privilege>' AND state <> 'idle'
AND pid <> pg_backend_pid()
AND NOT (
state = 'idle in transaction'
AND usename = 'postgres'
AND query LIKE '%pg_backup_start%'
)
ORDER BY query_start DESC
`))
expect(stdout).to.equal(FAKE_OUTPUT_TEXT)
Expand All @@ -90,6 +95,11 @@ SELECT pid,
FROM pg_stat_activity
WHERE query <> '<insufficient privilege>'
AND pid <> pg_backend_pid()
AND NOT (
state = 'idle in transaction'
AND usename = 'postgres'
AND query LIKE '%pg_backup_start%'
)
ORDER BY query_start DESC
`))
expect(stdout).to.equal(FAKE_OUTPUT_TEXT)
Expand Down
Loading