mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
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.
This commit is contained in:
8
repmgr.c
8
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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user