From b61ac86b5fbfd32a6bcec638d3a2df0b06fb9315 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Tue, 26 Jul 2011 16:12:11 -0500 Subject: [PATCH] Move repmgr_update_standby_location() and repmgr_get_last_standby_location() functions to repmgr schema. This will be important when we want to create this as an extension, so better make it be in the right place from day 1. --- repmgr.c | 8 ++++---- repmgrd.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/repmgr.c b/repmgr.c index 8f3c8fe2..d4a7cda7 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1949,9 +1949,9 @@ create_schema(PGconn *conn) /* XXX Here we MUST try to load the repmgr_function.sql not hardcode it here */ sqlquery_snprintf(sqlquery, - "CREATE OR REPLACE FUNCTION public.repmgr_update_standby_location(text) RETURNS boolean " + "CREATE OR REPLACE FUNCTION %s.repmgr_update_standby_location(text) RETURNS boolean " "AS '$libdir/repmgr_funcs', 'repmgr_update_standby_location' " - "LANGUAGE C STRICT "); + "LANGUAGE C STRICT ", repmgr_schema); if (!PQexec(conn, sqlquery)) { fprintf(stderr, "Cannot create the function repmgr_update_standby_location: %s\n", @@ -1960,9 +1960,9 @@ create_schema(PGconn *conn) } sqlquery_snprintf(sqlquery, - "CREATE OR REPLACE FUNCTION public.repmgr_get_last_standby_location() RETURNS text " + "CREATE OR REPLACE FUNCTION %s.repmgr_get_last_standby_location() RETURNS text " "AS '$libdir/repmgr_funcs', 'repmgr_get_last_standby_location' " - "LANGUAGE C STRICT "); + "LANGUAGE C STRICT ", repmgr_schema); if (!PQexec(conn, sqlquery)) { fprintf(stderr, "Cannot create the function repmgr_get_last_standby_location: %s\n", diff --git a/repmgrd.c b/repmgrd.c index 96c05de9..35445997 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -617,7 +617,7 @@ do_failover(void) if (PQstatus(nodeConn) != CONNECTION_OK) continue; - sqlquery_snprintf(sqlquery, "SELECT repmgr_get_last_standby_location()"); + sqlquery_snprintf(sqlquery, "SELECT %s.repmgr_get_last_standby_location()", repmgr_schema); res2 = PQexec(nodeConn, sqlquery); if (PQresultStatus(res2) != PGRES_TUPLES_OK) { @@ -949,8 +949,8 @@ update_shared_memory(char *last_wal_standby_applied) { PGresult *res; - sprintf(sqlquery, "SELECT repmgr_update_standby_location('%s')", - last_wal_standby_applied); + sprintf(sqlquery, "SELECT %s.repmgr_update_standby_location('%s')", + repmgr_schema, last_wal_standby_applied); /* If an error happens, just inform about that and continue */ res = PQexec(myLocalConn, sqlquery);