Always use catalog path when calling system functions

Removes any risk of issues due to search path mangling etc.
This commit is contained in:
Ian Barwick
2015-11-11 11:17:47 +09:00
parent 53ed8e948c
commit ea01d1d30b
2 changed files with 8 additions and 8 deletions

View File

@@ -189,7 +189,7 @@ is_standby(PGconn *conn)
PGresult *res;
int result = 0;
res = PQexec(conn, "SELECT pg_is_in_recovery()");
res = PQexec(conn, "SELECT pg_catalog.pg_is_in_recovery()");
if (res == NULL || PQresultStatus(res) != PGRES_TUPLES_OK)
{
@@ -405,7 +405,7 @@ get_cluster_size(PGconn *conn, char *size)
sqlquery_snprintf(
sqlquery,
"SELECT pg_size_pretty(SUM(pg_database_size(oid))::bigint) "
"SELECT pg_catalog.pg_size_pretty(SUM(pg_catalog.pg_database_size(oid))::bigint) "
" FROM pg_database ");
res = PQexec(conn, sqlquery);
@@ -618,7 +618,7 @@ get_master_connection(PGconn *standby_conn, char *cluster,
* function closes the connection passed and exits. This still needs
* to close master_conn first.
*/
res2 = PQexec(master_conn, "SELECT pg_is_in_recovery()");
res2 = PQexec(master_conn, "SELECT pg_catalog.pg_is_in_recovery()");
if (PQresultStatus(res2) != PGRES_TUPLES_OK)
{
@@ -871,7 +871,7 @@ start_backup(PGconn *conn, char *first_wal_segment, bool fast_checkpoint)
PGresult *res;
sqlquery_snprintf(sqlquery,
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld', %s))",
"SELECT pg_catalog.pg_xlogfile_name(pg_catalog.pg_start_backup('repmgr_standby_clone_%ld', %s))",
time(NULL),
fast_checkpoint ? "TRUE" : "FALSE");
@@ -906,7 +906,7 @@ stop_backup(PGconn *conn, char *last_wal_segment)
char sqlquery[QUERY_STR_LEN];
PGresult *res;
sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_stop_backup())");
sqlquery_snprintf(sqlquery, "SELECT pg_catalog.pg_xlogfile_name(pg_catalog.pg_stop_backup())");
res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)

View File

@@ -1014,7 +1014,7 @@ standby_monitor(void)
/* Get master xlog info */
sqlquery_snprintf(sqlquery, "SELECT pg_current_xlog_location()");
sqlquery_snprintf(sqlquery, "SELECT pg_catalog.pg_current_xlog_location()");
res = PQexec(master_conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -1234,7 +1234,7 @@ do_master_failover(void)
terminate(ERR_FAILOVER_FAIL);
}
sqlquery_snprintf(sqlquery, "SELECT pg_last_xlog_receive_location()");
sqlquery_snprintf(sqlquery, "SELECT pg_catalog.pg_last_xlog_receive_location()");
res = PQexec(node_conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
@@ -1266,7 +1266,7 @@ do_master_failover(void)
}
/* last we get info about this node, and update shared memory */
sprintf(sqlquery, "SELECT pg_last_xlog_receive_location()");
sprintf(sqlquery, "SELECT pg_catalog.pg_last_xlog_receive_location()");
res = PQexec(my_local_conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{