Merge lp:~ack/storm/postgres-9.2-tests-fix into lp:storm

Proposed by Alberto Donato
Status: Merged
Merged at revision: 474
Proposed branch: lp:~ack/storm/postgres-9.2-tests-fix
Merge into: lp:storm
Diff against target: 19 lines (+4/-2)
1 file modified
tests/databases/postgres.py (+4/-2)
To merge this branch: bzr merge lp:~ack/storm/postgres-9.2-tests-fix
Reviewer Review Type Date Requested Status
Benji York (community) Approve
Review via email: mp+260974@code.launchpad.net

Description of the change

This fixes a test failure with Postgres>=9.2.

The "pg_stat_activity.procpid" table has been renamed to "pid".

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good.

review: Approve
Revision history for this message
Alberto Donato (ack) :
Revision history for this message
Benji York (benji) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/databases/postgres.py'
2--- tests/databases/postgres.py 2013-09-25 22:06:34 +0000
3+++ tests/databases/postgres.py 2015-06-03 16:08:49 +0000
4@@ -57,11 +57,13 @@
5
6 def terminate_other_backends(connection):
7 """Terminate all connections to the database except the one given."""
8+ pid_column = "procpid" if connection._database._version < 90200 else "pid"
9 connection.execute(
10- "SELECT pg_terminate_backend(procpid)"
11+ "SELECT pg_terminate_backend(%(pid_column)s)"
12 " FROM pg_stat_activity"
13 " WHERE datname = current_database()"
14- " AND procpid != pg_backend_pid()")
15+ " AND %(pid_column)s != pg_backend_pid()" %
16+ {"pid_column": pid_column})
17
18
19 def terminate_all_backends(database):

Subscribers

People subscribed via source and target branches

to status/vote changes: