39 printf(
_(
"Failure, exiting\n"));
143 printf(
_(
"Failure, exiting\n"));
163 bool pg_ctl_return =
false;
167 static bool exit_hook_registered =
false;
169 if (!exit_hook_registered)
172 exit_hook_registered =
true;
175 socket_string[0] =
'\0';
179 strcat(socket_string,
180 " -c listen_addresses='' -c unix_socket_permissions=0700");
184 snprintf(socket_string + strlen(socket_string),
185 sizeof(socket_string) - strlen(socket_string),
188 "unix_socket_directory" :
"unix_socket_directories",
203 appendPQExpBufferStr(&pgoptions,
" -c synchronous_commit=off -c fsync=off -c full_page_writes=off");
210 "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d -b%s %s%s\" start",
228 report_and_exit_on_error,
false,
232 if (!pg_ctl_return && !report_and_exit_on_error)
264 pg_fatal(
"could not connect to source postmaster started with the command:\n"
268 pg_fatal(
"could not connect to target postmaster started with the command:\n"
282 pg_fatal(
"pg_ctl failed to start the source server, or connection failed");
284 pg_fatal(
"pg_ctl failed to start the target server, or connection failed");
304 "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" %s stop",
307 in_atexit ?
"-m fast" :
"-m smart");
333 if (
option->envvar && (strcmp(
option->envvar,
"PGHOST") == 0 ||
334 strcmp(
option->envvar,
"PGHOSTADDR") == 0))
340 (strcmp(
value,
"localhost") != 0 && strcmp(
value,
"127.0.0.1") != 0 &&
342 pg_fatal(
"libpq environment variable %s has a non-local server value: %s",
bool exec_prog(const char *log_filename, const char *opt_log_file, bool report_error, bool exit_on_error, const char *fmt,...)
void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
#define ALWAYS_SECURE_SEARCH_PATH_SQL
PGconn * PQconnectdb(const char *conninfo)
void PQconninfoFree(PQconninfoOption *connOptions)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
PQconninfoOption * PQconndefaults(void)
char * PQerrorMessage(const PGconn *conn)
PGresult * PQexec(PGconn *conn, const char *query)
#define SERVER_START_LOG_FILE
#define SERVER_STOP_LOG_FILE
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define GET_MAJOR_VERSION(v)
static bool is_unixsock_path(const char *path)
PQExpBuffer createPQExpBuffer(void)
void initPQExpBuffer(PQExpBuffer str)
void resetPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
static PGconn * get_db_conn(ClusterInfo *cluster, const char *db_name)
void check_pghost_envvar(void)
bool start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
void stop_postmaster(bool in_atexit)
char * cluster_conn_opts(ClusterInfo *cluster)
static void stop_postmaster_atexit(void)
void appendShellString(PQExpBuffer buf, const char *str)
void appendConnStrVal(PQExpBuffer buf, const char *str)
ClusterInfo * running_cluster