Permalink
Browse files

Add support for PG 9.2

  • Loading branch information...
1 parent bee4e42 commit 60058ff99566d1810341c24af171354d62a8dcd7 @asheshv asheshv committed with dpage Sep 12, 2012
Showing with 22 additions and 7 deletions.
  1. +2 −0 include/connection.h
  2. +20 −7 pgAgent.cpp
View
@@ -66,7 +66,9 @@ class DBconn
case PGRES_TUPLES_OK:
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
+#if (PG_VERSION_NUM >= 90100)
case PGRES_COPY_BOTH:
+#endif
return true;
default:
return false;
View
@@ -41,13 +41,26 @@ int MainRestartLoop(DBconn *serviceConn)
LogMessage(_("Clearing zombies"), LOG_DEBUG);
rc = serviceConn->ExecuteVoid(wxT("CREATE TEMP TABLE pga_tmp_zombies(jagpid int4)"));
- rc = serviceConn->ExecuteVoid(
- wxT("INSERT INTO pga_tmp_zombies (jagpid) ")
- wxT("SELECT jagpid ")
- wxT(" FROM pgagent.pga_jobagent AG ")
- wxT(" LEFT JOIN pg_stat_activity PA ON jagpid=procpid ")
- wxT(" WHERE procpid IS NULL")
- );
+ if (serviceConn->BackendMinimumVersion(9, 2))
+ {
+ rc = serviceConn->ExecuteVoid(
+ wxT("INSERT INTO pga_tmp_zombies (jagpid) ")
+ wxT("SELECT jagpid ")
+ wxT(" FROM pgagent.pga_jobagent AG ")
+ wxT(" LEFT JOIN pg_stat_activity PA ON jagpid=pid ")
+ wxT(" WHERE pid IS NULL")
+ );
+ }
+ else
+ {
+ rc = serviceConn->ExecuteVoid(
+ wxT("INSERT INTO pga_tmp_zombies (jagpid) ")
+ wxT("SELECT jagpid ")
+ wxT(" FROM pgagent.pga_jobagent AG ")
+ wxT(" LEFT JOIN pg_stat_activity PA ON jagpid=procpid ")
+ wxT(" WHERE procpid IS NULL")
+ );
+ }
if (rc > 0)
{

0 comments on commit 60058ff

Please sign in to comment.