Browse Source

Merge lp:~brianaker/gearmand/postgres-is_fix Build: jenkins-Gearmand-824

Continuous Integration 11 years ago
parent
commit
38ccd6fcdf
1 changed files with 3 additions and 7 deletions
  1. 3 7
      libgearman-server/plugins/queue/postgres/queue.cc

+ 3 - 7
libgearman-server/plugins/queue/postgres/queue.cc

@@ -203,7 +203,7 @@ gearmand_error_t _initialize(gearman_server_st& server,
 
   (void)PQsetNoticeProcessor(queue->con, _libpq_notice_processor, &server);
 
-  std::string query("SELECT tablename FROM pg_tables WHERE tablename='" +queue->table + "'");
+  std::string query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME ='" +queue->table + "'");
 
   PGresult* result= PQexec(queue->con, query.c_str());
   if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK)
@@ -230,14 +230,10 @@ gearmand_error_t _initialize(gearman_server_st& server,
       gearman_server_set_queue(server, NULL, NULL, NULL, NULL, NULL);
       return GEARMAND_QUEUE_ERROR;
     }
-
-    PQclear(result);
-  }
-  else
-  {
-    PQclear(result);
   }
 
+  PQclear(result);
+
   return GEARMAND_SUCCESS;
 }