Просмотр исходного кода

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

Continuous Integration 11 лет назад
Родитель
Сommit
38ccd6fcdf
1 измененных файлов с 3 добавлено и 7 удалено
  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);
   (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());
   PGresult* result= PQexec(queue->con, query.c_str());
   if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK)
   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);
       gearman_server_set_queue(server, NULL, NULL, NULL, NULL, NULL);
       return GEARMAND_QUEUE_ERROR;
       return GEARMAND_QUEUE_ERROR;
     }
     }
-
-    PQclear(result);
-  }
-  else
-  {
-    PQclear(result);
   }
   }
 
 
+  PQclear(result);
+
   return GEARMAND_SUCCESS;
   return GEARMAND_SUCCESS;
 }
 }