{
pg_log(PG_REPORT,
"Performing Consistency Checks on Old Live Server\n"
- "------------------------------------------------\n");
+ "------------------------------------------------");
}
else
{
pg_log(PG_REPORT,
"Performing Consistency Checks\n"
- "-----------------------------\n");
+ "-----------------------------");
}
}
{
if (user_opts.check)
{
- pg_log(PG_REPORT, "\n*Clusters are compatible*\n");
+ pg_log(PG_REPORT, "\n*Clusters are compatible*");
/* stops new cluster */
stop_postmaster(false);
pg_log(PG_REPORT, "\n"
"If pg_upgrade fails after this point, you must re-initdb the\n"
- "new cluster before continuing.\n");
+ "new cluster before continuing.");
}
pg_log(PG_REPORT,
"Optimizer statistics are not transferred by pg_upgrade.\n"
"Once you start the new server, consider running:\n"
- " %s/vacuumdb %s--all --analyze-in-stages\n\n", new_cluster.bindir, user_specification.data);
+ " %s/vacuumdb %s--all --analyze-in-stages", new_cluster.bindir, user_specification.data);
if (deletion_script_file_name)
pg_log(PG_REPORT,
"Running this script will delete the old cluster's data files:\n"
- " %s\n",
+ " %s",
deletion_script_file_name);
else
pg_log(PG_REPORT,
"Could not create a script to delete the old cluster's data files\n"
"because user-defined tablespaces or the new cluster's data directory\n"
"exist in the old cluster directory. The old cluster's contents must\n"
- "be deleted manually.\n");
+ "be deleted manually.");
termPQExpBuffer(&user_specification);
}
*/
if (GET_MAJOR_VERSION(old_cluster.major_version) < 902)
- pg_fatal("This utility can only upgrade from PostgreSQL version %s and later.\n",
+ pg_fatal("This utility can only upgrade from PostgreSQL version %s and later.",
"9.2");
/* Only current PG version is supported as a target */
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
- pg_fatal("This utility can only upgrade to PostgreSQL version %s.\n",
+ pg_fatal("This utility can only upgrade to PostgreSQL version %s.",
PG_MAJORVERSION);
/*
* older versions.
*/
if (old_cluster.major_version > new_cluster.major_version)
- pg_fatal("This utility cannot be used to downgrade to older major PostgreSQL versions.\n");
+ pg_fatal("This utility cannot be used to downgrade to older major PostgreSQL versions.");
/* Ensure binaries match the designated data directories */
if (GET_MAJOR_VERSION(old_cluster.major_version) !=
GET_MAJOR_VERSION(old_cluster.bin_version))
- pg_fatal("Old cluster data and binary directories are from different major versions.\n");
+ pg_fatal("Old cluster data and binary directories are from different major versions.");
if (GET_MAJOR_VERSION(new_cluster.major_version) !=
GET_MAJOR_VERSION(new_cluster.bin_version))
- pg_fatal("New cluster data and binary directories are from different major versions.\n");
+ pg_fatal("New cluster data and binary directories are from different major versions.");
check_ok();
}
if (live_check && old_cluster.port == new_cluster.port)
pg_fatal("When checking a live server, "
- "the old and new port numbers must be different.\n");
+ "the old and new port numbers must be different.");
}
check_locale_and_encoding(DbInfo *olddb, DbInfo *newdb)
{
if (olddb->db_encoding != newdb->db_encoding)
- pg_fatal("encodings for database \"%s\" do not match: old \"%s\", new \"%s\"\n",
+ pg_fatal("encodings for database \"%s\" do not match: old \"%s\", new \"%s\"",
olddb->db_name,
pg_encoding_to_char(olddb->db_encoding),
pg_encoding_to_char(newdb->db_encoding));
if (!equivalent_locale(LC_COLLATE, olddb->db_collate, newdb->db_collate))
- pg_fatal("lc_collate values for database \"%s\" do not match: old \"%s\", new \"%s\"\n",
+ pg_fatal("lc_collate values for database \"%s\" do not match: old \"%s\", new \"%s\"",
olddb->db_name, olddb->db_collate, newdb->db_collate);
if (!equivalent_locale(LC_CTYPE, olddb->db_ctype, newdb->db_ctype))
- pg_fatal("lc_ctype values for database \"%s\" do not match: old \"%s\", new \"%s\"\n",
+ pg_fatal("lc_ctype values for database \"%s\" do not match: old \"%s\", new \"%s\"",
olddb->db_name, olddb->db_ctype, newdb->db_ctype);
if (olddb->db_collprovider != newdb->db_collprovider)
- pg_fatal("locale providers for database \"%s\" do not match: old \"%s\", new \"%s\"\n",
+ pg_fatal("locale providers for database \"%s\" do not match: old \"%s\", new \"%s\"",
olddb->db_name,
collprovider_name(olddb->db_collprovider),
collprovider_name(newdb->db_collprovider));
if ((olddb->db_iculocale == NULL && newdb->db_iculocale != NULL) ||
(olddb->db_iculocale != NULL && newdb->db_iculocale == NULL) ||
(olddb->db_iculocale != NULL && newdb->db_iculocale != NULL && strcmp(olddb->db_iculocale, newdb->db_iculocale) != 0))
- pg_fatal("ICU locale values for database \"%s\" do not match: old \"%s\", new \"%s\"\n",
+ pg_fatal("ICU locale values for database \"%s\" do not match: old \"%s\", new \"%s\"",
olddb->db_name,
olddb->db_iculocale ? olddb->db_iculocale : "(null)",
newdb->db_iculocale ? newdb->db_iculocale : "(null)");
{
/* pg_largeobject and its index should be skipped */
if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0)
- pg_fatal("New cluster database \"%s\" is not empty: found relation \"%s.%s\"\n",
+ pg_fatal("New cluster database \"%s\" is not empty: found relation \"%s.%s\"",
new_cluster.dbarr.dbs[dbnum].db_name,
rel_arr->rels[relnum].nspname,
rel_arr->rels[relnum].relname);
new_cluster->tablespace_suffix);
if (stat(new_tablespace_dir, &statbuf) == 0 || errno != ENOENT)
- pg_fatal("new cluster tablespace directory already exists: \"%s\"\n",
+ pg_fatal("new cluster tablespace directory already exists: \"%s\"",
new_tablespace_dir);
}
if (path_is_prefix_of_path(old_cluster_pgdata, new_cluster_pgdata))
{
pg_log(PG_WARNING,
- "\nWARNING: new data directory should not be inside the old data directory, e.g. %s\n", old_cluster_pgdata);
+ "\nWARNING: new data directory should not be inside the old data directory, e.g. %s", old_cluster_pgdata);
/* Unlink file in case it is left over from a previous run. */
unlink(*deletion_script_file_name);
{
/* reproduce warning from CREATE TABLESPACE that is in the log */
pg_log(PG_WARNING,
- "\nWARNING: user-defined tablespace locations should not be inside the data directory, e.g. %s\n", old_tablespace_dir);
+ "\nWARNING: user-defined tablespace locations should not be inside the data directory, e.g. %s", old_tablespace_dir);
/* Unlink file in case it is left over from a previous run. */
unlink(*deletion_script_file_name);
prep_status("Creating script to delete old cluster");
if ((script = fopen_priv(*deletion_script_file_name, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
*deletion_script_file_name, strerror(errno));
#ifndef WIN32
#ifndef WIN32
if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
- pg_fatal("could not add execute permission to file \"%s\": %s\n",
+ pg_fatal("could not add execute permission to file \"%s\": %s",
*deletion_script_file_name, strerror(errno));
#endif
*/
if (PQntuples(res) != 1 ||
atooid(PQgetvalue(res, 0, 1)) != BOOTSTRAP_SUPERUSERID)
- pg_fatal("database user \"%s\" is not the install user\n",
+ pg_fatal("database user \"%s\" is not the install user",
os_info.user);
PQclear(res);
"WHERE rolname !~ '^pg_'");
if (PQntuples(res) != 1)
- pg_fatal("could not determine the number of users\n");
+ pg_fatal("could not determine the number of users");
/*
* We only allow the install user in the new cluster because other defined
* error during pg_dump restore.
*/
if (cluster == &new_cluster && atooid(PQgetvalue(res, 0, 0)) != 1)
- pg_fatal("Only the install user can be defined in the new cluster.\n");
+ pg_fatal("Only the install user can be defined in the new cluster.");
PQclear(res);
/* avoid restore failure when pg_dumpall tries to create template0 */
if (strcmp(datallowconn, "t") == 0)
pg_fatal("template0 must not allow connections, "
- "i.e. its pg_database.datallowconn must be false\n");
+ "i.e. its pg_database.datallowconn must be false");
}
else
{
{
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
fprintf(script, "%s\n", datname);
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("All non-template0 databases must allow connections, i.e. their\n"
"pg_database.datallowconn must be true. Your installation contains\n"
"non-template0 databases with their pg_database.datallowconn set to\n"
"false. Consider allowing connection for all non-template0 databases\n"
"or drop the databases which do not allow connections. A list of\n"
"databases with the problem is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (PQntuples(res) != 0)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster contains prepared transactions\n");
+ pg_fatal("The source cluster contains prepared transactions");
else
- pg_fatal("The target cluster contains prepared transactions\n");
+ pg_fatal("The target cluster contains prepared transactions");
}
PQclear(res);
{
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
if (!db_used)
{
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains \"contrib/isn\" functions which rely on the\n"
"bigint data type. Your old and new clusters pass bigint values\n"
"differently so this cluster cannot currently be upgraded. You can\n"
"manually dump databases in the old cluster that use \"contrib/isn\"\n"
"facilities, drop them, perform the upgrade, and then restore them. A\n"
"list of the problem functions is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
found = true;
if (script == NULL &&
(script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
if (!db_used)
{
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains user-defined postfix operators, which are not\n"
"supported anymore. Consider dropping the postfix operators and replacing\n"
"them with prefix operators or function calls.\n"
"A list of user-defined postfix operators is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
{
if (script == NULL &&
(script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
if (!db_used)
{
if (script)
{
fclose(script);
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains user-defined objects that refer to internal\n"
"polymorphic functions with arguments of type 'anyarray' or 'anyelement'.\n"
"These user-defined objects must be dropped before upgrading and restored\n"
"afterwards, changing them to refer to the new corresponding functions with\n"
"arguments of type 'anycompatiblearray' and 'anycompatible'.\n"
"A list of the problematic objects is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
{
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
if (!db_used)
{
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains tables declared WITH OIDS, which is not\n"
"supported anymore. Consider removing the oid column using\n"
" ALTER TABLE ... SET WITHOUT OIDS;\n"
"A list of tables with the problem is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains system-defined composite type(s) in user tables.\n"
"These type OIDs are not stable across PostgreSQL versions,\n"
"so this cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains one of the reg* data types in user tables.\n"
"These data types reference system OIDs that are not preserved by\n"
"pg_upgrade, so this cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (check_for_data_type_usage(cluster, "pg_catalog.jsonb", output_path))
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains the \"jsonb\" data type in user tables.\n"
"The internal format of \"jsonb\" changed during 9.4 beta so this\n"
"cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (PQntuples(res) != 0)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster contains roles starting with \"pg_\"\n");
+ pg_fatal("The source cluster contains roles starting with \"pg_\"");
else
- pg_fatal("The target cluster contains roles starting with \"pg_\"\n");
+ pg_fatal("The target cluster contains roles starting with \"pg_\"");
}
PQclear(res);
found = true;
if (script == NULL &&
(script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
if (!db_used)
{
if (found)
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains user-defined encoding conversions.\n"
"The conversion function parameters changed in PostgreSQL version 14\n"
"so this cluster cannot currently be upgraded. You can remove the\n"
"encoding conversions in the old cluster and restart the upgrade.\n"
"A list of user-defined encoding conversions is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
/* get the current setting, so we can restore it. */
save = setlocale(category, NULL);
if (!save)
- pg_fatal("failed to get the current locale\n");
+ pg_fatal("failed to get the current locale");
/* 'save' may be pointing at a modifiable scratch variable, so copy it. */
save = pg_strdup(save);
res = setlocale(category, locale);
if (!res)
- pg_fatal("failed to get system locale name for \"%s\"\n", locale);
+ pg_fatal("failed to get system locale name for \"%s\"", locale);
res = pg_strdup(res);
/* restore old value. */
if (!setlocale(category, save))
- pg_fatal("failed to restore old locale \"%s\"\n", save);
+ pg_fatal("failed to restore old locale \"%s\"", save);
pg_free(save);
#include <ctype.h>
#include "pg_upgrade.h"
+#include "common/string.h"
+
/*
* get_control_data()
fflush(stderr);
if ((output = popen(cmd, "r")) == NULL)
- pg_fatal("could not get control data using %s: %s\n",
+ pg_fatal("could not get control data using %s: %s",
cmd, strerror(errno));
/* we have the result of cmd in "output". so parse it line by line now */
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: database cluster state problem\n", __LINE__);
+ pg_fatal("%d: database cluster state problem", __LINE__);
p++; /* remove ':' char */
if (strcmp(p, "shut down in recovery\n") == 0)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.\n");
+ pg_fatal("The source cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
else
- pg_fatal("The target cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.\n");
+ pg_fatal("The target cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
}
else if (strcmp(p, "shut down\n") != 0)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster was not shut down cleanly.\n");
+ pg_fatal("The source cluster was not shut down cleanly.");
else
- pg_fatal("The target cluster was not shut down cleanly.\n");
+ pg_fatal("The target cluster was not shut down cleanly.");
}
got_cluster_state = true;
}
if (!got_cluster_state)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster lacks cluster state information:\n");
+ pg_fatal("The source cluster lacks cluster state information:");
else
- pg_fatal("The target cluster lacks cluster state information:\n");
+ pg_fatal("The target cluster lacks cluster state information:");
}
}
fflush(stderr);
if ((output = popen(cmd, "r")) == NULL)
- pg_fatal("could not get control data using %s: %s\n",
+ pg_fatal("could not get control data using %s: %s",
cmd, strerror(errno));
/* Only in <= 9.2 */
/* we have the result of cmd in "output". so parse it line by line now */
while (fgets(bufin, sizeof(bufin), output))
{
+ /* In verbose mode, log each line */
+ pg_strip_crlf(bufin);
pg_log(PG_VERBOSE, "%s", bufin);
if ((p = strstr(bufin, "pg_control version number:")) != NULL)
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: pg_resetwal problem\n", __LINE__);
+ pg_fatal("%d: pg_resetwal problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.ctrl_ver = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.cat_ver = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
tli = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
logid = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
segno = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_nxtepoch = str2uint(p);
p = NULL;
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove '/' or ':' char */
cluster->controldata.chkpnt_nxtxid = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_nxtoid = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_nxtmulti = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_oldstxid = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_oldstMulti = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.chkpnt_nxtmxoff = str2uint(p);
/* Skip the colon and any whitespace after it */
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p = strpbrk(p, "01234567890ABCDEF");
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
/* Make sure it looks like a valid WAL file name */
if (strspn(p, "0123456789ABCDEF") != 24)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
strlcpy(cluster->controldata.nextxlogfile, p, 25);
got_nextxlogfile = true;
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
/* used later for contrib check */
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.align = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.blocksz = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.largesz = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.walsz = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.walseg = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.ident = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.index = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.toast = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.large_object = str2uint(p);
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
cluster->controldata.date_is_int = strstr(p, "64-bit integers") != NULL;
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
- pg_fatal("%d: controldata retrieval problem\n", __LINE__);
+ pg_fatal("%d: controldata retrieval problem", __LINE__);
p++; /* remove ':' char */
/* used later for contrib check */
{
if (cluster == &old_cluster)
pg_log(PG_REPORT,
- "The source cluster lacks some required control information:\n");
+ "The source cluster lacks some required control information:");
else
pg_log(PG_REPORT,
- "The target cluster lacks some required control information:\n");
+ "The target cluster lacks some required control information:");
if (!got_xid)
- pg_log(PG_REPORT, " checkpoint next XID\n");
+ pg_log(PG_REPORT, " checkpoint next XID");
if (!got_oid)
- pg_log(PG_REPORT, " latest checkpoint next OID\n");
+ pg_log(PG_REPORT, " latest checkpoint next OID");
if (!got_multi)
- pg_log(PG_REPORT, " latest checkpoint next MultiXactId\n");
+ pg_log(PG_REPORT, " latest checkpoint next MultiXactId");
if (!got_oldestmulti &&
cluster->controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
- pg_log(PG_REPORT, " latest checkpoint oldest MultiXactId\n");
+ pg_log(PG_REPORT, " latest checkpoint oldest MultiXactId");
if (!got_oldestxid)
- pg_log(PG_REPORT, " latest checkpoint oldestXID\n");
+ pg_log(PG_REPORT, " latest checkpoint oldestXID");
if (!got_mxoff)
- pg_log(PG_REPORT, " latest checkpoint next MultiXactOffset\n");
+ pg_log(PG_REPORT, " latest checkpoint next MultiXactOffset");
if (!live_check && !got_nextxlogfile)
- pg_log(PG_REPORT, " first WAL segment after reset\n");
+ pg_log(PG_REPORT, " first WAL segment after reset");
if (!got_float8_pass_by_value)
- pg_log(PG_REPORT, " float8 argument passing method\n");
+ pg_log(PG_REPORT, " float8 argument passing method");
if (!got_align)
- pg_log(PG_REPORT, " maximum alignment\n");
+ pg_log(PG_REPORT, " maximum alignment");
if (!got_blocksz)
- pg_log(PG_REPORT, " block size\n");
+ pg_log(PG_REPORT, " block size");
if (!got_largesz)
- pg_log(PG_REPORT, " large relation segment size\n");
+ pg_log(PG_REPORT, " large relation segment size");
if (!got_walsz)
- pg_log(PG_REPORT, " WAL block size\n");
+ pg_log(PG_REPORT, " WAL block size");
if (!got_walseg)
- pg_log(PG_REPORT, " WAL segment size\n");
+ pg_log(PG_REPORT, " WAL segment size");
if (!got_ident)
- pg_log(PG_REPORT, " maximum identifier length\n");
+ pg_log(PG_REPORT, " maximum identifier length");
if (!got_index)
- pg_log(PG_REPORT, " maximum number of indexed columns\n");
+ pg_log(PG_REPORT, " maximum number of indexed columns");
if (!got_toast)
- pg_log(PG_REPORT, " maximum TOAST chunk size\n");
+ pg_log(PG_REPORT, " maximum TOAST chunk size");
if (!got_large_object &&
cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER)
- pg_log(PG_REPORT, " large-object chunk size\n");
+ pg_log(PG_REPORT, " large-object chunk size");
if (!got_date_is_int)
- pg_log(PG_REPORT, " dates/times are integers?\n");
+ pg_log(PG_REPORT, " dates/times are integers?");
/* value added in Postgres 9.3 */
if (!got_data_checksum_version)
- pg_log(PG_REPORT, " data checksum version\n");
+ pg_log(PG_REPORT, " data checksum version");
- pg_fatal("Cannot continue without required control information, terminating\n");
+ pg_fatal("Cannot continue without required control information, terminating");
}
}
ControlData *newctrl)
{
if (oldctrl->align == 0 || oldctrl->align != newctrl->align)
- pg_fatal("old and new pg_controldata alignments are invalid or do not match\n"
- "Likely one cluster is a 32-bit install, the other 64-bit\n");
+ pg_fatal("old and new pg_controldata alignments are invalid or do not match.\n"
+ "Likely one cluster is a 32-bit install, the other 64-bit");
if (oldctrl->blocksz == 0 || oldctrl->blocksz != newctrl->blocksz)
- pg_fatal("old and new pg_controldata block sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata block sizes are invalid or do not match");
if (oldctrl->largesz == 0 || oldctrl->largesz != newctrl->largesz)
- pg_fatal("old and new pg_controldata maximum relation segment sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata maximum relation segment sizes are invalid or do not match");
if (oldctrl->walsz == 0 || oldctrl->walsz != newctrl->walsz)
- pg_fatal("old and new pg_controldata WAL block sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata WAL block sizes are invalid or do not match");
if (oldctrl->walseg == 0 || oldctrl->walseg != newctrl->walseg)
- pg_fatal("old and new pg_controldata WAL segment sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata WAL segment sizes are invalid or do not match");
if (oldctrl->ident == 0 || oldctrl->ident != newctrl->ident)
- pg_fatal("old and new pg_controldata maximum identifier lengths are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata maximum identifier lengths are invalid or do not match");
if (oldctrl->index == 0 || oldctrl->index != newctrl->index)
- pg_fatal("old and new pg_controldata maximum indexed columns are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata maximum indexed columns are invalid or do not match");
if (oldctrl->toast == 0 || oldctrl->toast != newctrl->toast)
- pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match");
/* large_object added in 9.5, so it might not exist in the old cluster */
if (oldctrl->large_object != 0 &&
oldctrl->large_object != newctrl->large_object)
- pg_fatal("old and new pg_controldata large-object chunk sizes are invalid or do not match\n");
+ pg_fatal("old and new pg_controldata large-object chunk sizes are invalid or do not match");
if (oldctrl->date_is_int != newctrl->date_is_int)
- pg_fatal("old and new pg_controldata date/time storage types do not match\n");
+ pg_fatal("old and new pg_controldata date/time storage types do not match");
/*
* float8_pass_by_value does not need to match, but is used in
*/
if (oldctrl->data_checksum_version == 0 &&
newctrl->data_checksum_version != 0)
- pg_fatal("old cluster does not use data checksums but the new one does\n");
+ pg_fatal("old cluster does not use data checksums but the new one does");
else if (oldctrl->data_checksum_version != 0 &&
newctrl->data_checksum_version == 0)
- pg_fatal("old cluster uses data checksums but the new one does not\n");
+ pg_fatal("old cluster uses data checksums but the new one does not");
else if (oldctrl->data_checksum_version != newctrl->data_checksum_version)
- pg_fatal("old and new cluster pg_controldata checksum versions do not match\n");
+ pg_fatal("old and new cluster pg_controldata checksum versions do not match");
}
snprintf(old_path, sizeof(old_path), "%s/global/pg_control", old_cluster.pgdata);
snprintf(new_path, sizeof(new_path), "%s/global/pg_control.old", old_cluster.pgdata);
if (pg_mv_file(old_path, new_path) != 0)
- pg_fatal("Unable to rename %s to %s.\n", old_path, new_path);
+ pg_fatal("could not rename file \"%s\" to \"%s\": %m",
+ old_path, new_path);
check_ok();
pg_log(PG_REPORT, "\n"
"If you want to start the old cluster, you will need to remove\n"
"the \".old\" suffix from %s/global/pg_control.old.\n"
"Because \"link\" mode was used, the old cluster cannot be safely\n"
- "started once the new cluster has been started.\n\n", old_cluster.pgdata);
+ "started once the new cluster has been started.",
+ old_cluster.pgdata);
}
if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL)
- pg_fatal("could not get pg_ctl version data using %s: %s\n",
+ pg_fatal("could not get pg_ctl version data using %s: %s",
cmd, strerror(errno));
pclose(output);
if (sscanf(cmd_output, "%*s %*s %d.%d", &v1, &v2) < 1)
- pg_fatal("could not get pg_ctl version output from %s\n", cmd);
+ pg_fatal("could not get pg_ctl version output from %s", cmd);
if (v1 < 10)
{
written += vsnprintf(cmd + written, MAXCMDLEN - written, fmt, ap);
va_end(ap);
if (written >= MAXCMDLEN)
- pg_fatal("command too long\n");
+ pg_fatal("command too long");
written += snprintf(cmd + written, MAXCMDLEN - written,
" >> \"%s\" 2>&1", log_file);
if (written >= MAXCMDLEN)
- pg_fatal("command too long\n");
+ pg_fatal("command too long");
- pg_log(PG_VERBOSE, "%s\n", cmd);
+ pg_log(PG_VERBOSE, "%s", cmd);
#ifdef WIN32
#endif
if (log == NULL)
- pg_fatal("could not open log file \"%s\": %m\n", log_file);
+ pg_fatal("could not open log file \"%s\": %m", log_file);
#ifdef WIN32
/* Are we printing "command:" before its output? */
report_status(PG_REPORT, "\n*failure*");
fflush(stdout);
- pg_log(PG_VERBOSE, "There were problems executing \"%s\"\n", cmd);
+ pg_log(PG_VERBOSE, "There were problems executing \"%s\"", cmd);
if (opt_log_file)
pg_log(exit_on_error ? PG_FATAL : PG_REPORT,
"Consult the last few lines of \"%s\" or \"%s\" for\n"
- "the probable cause of the failure.\n",
+ "the probable cause of the failure.",
log_file, opt_log_file);
else
pg_log(exit_on_error ? PG_FATAL : PG_REPORT,
"Consult the last few lines of \"%s\" for\n"
- "the probable cause of the failure.\n",
+ "the probable cause of the failure.",
log_file);
}
* log these commands to a third file, but that just adds complexity.
*/
if ((log = fopen(log_file, "a")) == NULL)
- pg_fatal("could not write to log file \"%s\": %m\n", log_file);
+ pg_fatal("could not write to log file \"%s\": %m", log_file);
fprintf(log, "\n\n");
fclose(log);
#endif
{
/* ENOTDIR means we will throw a more useful error later */
if (errno != ENOENT && errno != ENOTDIR)
- pg_fatal("could not open file \"%s\" for reading: %s\n",
+ pg_fatal("could not open file \"%s\" for reading: %s",
path, strerror(errno));
return false;
#else
if (win32_check_directory_write_permissions() != 0)
#endif
- pg_fatal("You must have read and write access in the current directory.\n");
+ pg_fatal("You must have read and write access in the current directory.");
check_bin_dir(&old_cluster, false);
check_data_dir(&old_cluster);
subdir);
if (stat(subDirName, &statBuf) != 0)
- report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
+ report_status(PG_FATAL, "check for \"%s\" failed: %s",
subDirName, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
- report_status(PG_FATAL, "\"%s\" is not a directory\n",
+ report_status(PG_FATAL, "\"%s\" is not a directory",
subDirName);
}
/* check bindir */
if (stat(cluster->bindir, &statBuf) != 0)
- report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
+ report_status(PG_FATAL, "check for \"%s\" failed: %s",
cluster->bindir, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
- report_status(PG_FATAL, "\"%s\" is not a directory\n",
+ report_status(PG_FATAL, "\"%s\" is not a directory",
cluster->bindir);
check_exec(cluster->bindir, "postgres", check_versions);
ret = validate_exec(path);
if (ret == -1)
- pg_fatal("check for \"%s\" failed: not a regular file\n",
+ pg_fatal("check for \"%s\" failed: does not exist or cannot be executed",
path);
else if (ret == -2)
- pg_fatal("check for \"%s\" failed: cannot execute (permission denied)\n",
+ pg_fatal("check for \"%s\" failed: cannot read (permission denied)",
path);
snprintf(cmd, sizeof(cmd), "\"%s\" -V", path);
if (!pipe_read_line(cmd, line, sizeof(line)))
- pg_fatal("check for \"%s\" failed: cannot execute\n",
+ pg_fatal("check for \"%s\" failed: cannot execute",
path);
if (check_version)
snprintf(versionstr, sizeof(versionstr), "%s (PostgreSQL) " PG_VERSION, program);
if (strcmp(line, versionstr) != 0)
- pg_fatal("check for \"%s\" failed: incorrect version: found \"%s\", expected \"%s\"\n",
+ pg_fatal("check for \"%s\" failed: incorrect version: found \"%s\", expected \"%s\"",
path, line, versionstr);
}
}
{
#if defined(HAVE_COPYFILE) && defined(COPYFILE_CLONE_FORCE)
if (copyfile(src, dst, NULL, COPYFILE_CLONE_FORCE) < 0)
- pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
+ pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s",
schemaName, relName, src, dst, strerror(errno));
#elif defined(__linux__) && defined(FICLONE)
int src_fd;
int dest_fd;
if ((src_fd = open(src, O_RDONLY | PG_BINARY, 0)) < 0)
- pg_fatal("error while cloning relation \"%s.%s\": could not open file \"%s\": %s\n",
+ pg_fatal("error while cloning relation \"%s.%s\": could not open file \"%s\": %s",
schemaName, relName, src, strerror(errno));
if ((dest_fd = open(dst, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
pg_file_create_mode)) < 0)
- pg_fatal("error while cloning relation \"%s.%s\": could not create file \"%s\": %s\n",
+ pg_fatal("error while cloning relation \"%s.%s\": could not create file \"%s\": %s",
schemaName, relName, dst, strerror(errno));
if (ioctl(dest_fd, FICLONE, src_fd) < 0)
{
unlink(dst);
- pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
+ pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s",
schemaName, relName, src, dst, strerror(errno));
}
char *buffer;
if ((src_fd = open(src, O_RDONLY | PG_BINARY, 0)) < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not open file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not open file \"%s\": %s",
schemaName, relName, src, strerror(errno));
if ((dest_fd = open(dst, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
pg_file_create_mode)) < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not create file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not create file \"%s\": %s",
schemaName, relName, dst, strerror(errno));
/* copy in fairly large chunks for best efficiency */
ssize_t nbytes = read(src_fd, buffer, COPY_BUF_SIZE);
if (nbytes < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not read file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not read file \"%s\": %s",
schemaName, relName, src, strerror(errno));
if (nbytes == 0)
/* if write didn't set errno, assume problem is no disk space */
if (errno == 0)
errno = ENOSPC;
- pg_fatal("error while copying relation \"%s.%s\": could not write file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not write file \"%s\": %s",
schemaName, relName, dst, strerror(errno));
}
}
if (CopyFile(src, dst, true) == 0)
{
_dosmaperr(GetLastError());
- pg_fatal("error while copying relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
+ pg_fatal("error while copying relation \"%s.%s\" (\"%s\" to \"%s\"): %s",
schemaName, relName, src, dst, strerror(errno));
}
const char *schemaName, const char *relName)
{
if (link(src, dst) < 0)
- pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
+ pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s",
schemaName, relName, src, dst, strerror(errno));
}
rewriteVmBytesPerPage = (BLCKSZ - SizeOfPageHeaderData) / 2;
if ((src_fd = open(fromfile, O_RDONLY | PG_BINARY, 0)) < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not open file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not open file \"%s\": %s",
schemaName, relName, fromfile, strerror(errno));
if (fstat(src_fd, &statbuf) != 0)
- pg_fatal("error while copying relation \"%s.%s\": could not stat file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not stat file \"%s\": %s",
schemaName, relName, fromfile, strerror(errno));
if ((dst_fd = open(tofile, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
pg_file_create_mode)) < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not create file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not create file \"%s\": %s",
schemaName, relName, tofile, strerror(errno));
/* Save old file size */
if ((bytesRead = read(src_fd, buffer.data, BLCKSZ)) != BLCKSZ)
{
if (bytesRead < 0)
- pg_fatal("error while copying relation \"%s.%s\": could not read file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not read file \"%s\": %s",
schemaName, relName, fromfile, strerror(errno));
else
- pg_fatal("error while copying relation \"%s.%s\": partial page found in file \"%s\"\n",
+ pg_fatal("error while copying relation \"%s.%s\": partial page found in file \"%s\"",
schemaName, relName, fromfile);
}
/* if write didn't set errno, assume problem is no disk space */
if (errno == 0)
errno = ENOSPC;
- pg_fatal("error while copying relation \"%s.%s\": could not write file \"%s\": %s\n",
+ pg_fatal("error while copying relation \"%s.%s\": could not write file \"%s\": %s",
schemaName, relName, tofile, strerror(errno));
}
#if defined(HAVE_COPYFILE) && defined(COPYFILE_CLONE_FORCE)
if (copyfile(existing_file, new_link_file, NULL, COPYFILE_CLONE_FORCE) < 0)
- pg_fatal("could not clone file between old and new data directories: %s\n",
+ pg_fatal("could not clone file between old and new data directories: %s",
strerror(errno));
#elif defined(__linux__) && defined(FICLONE)
{
int dest_fd;
if ((src_fd = open(existing_file, O_RDONLY | PG_BINARY, 0)) < 0)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
existing_file, strerror(errno));
if ((dest_fd = open(new_link_file, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
pg_file_create_mode)) < 0)
- pg_fatal("could not create file \"%s\": %s\n",
+ pg_fatal("could not create file \"%s\": %s",
new_link_file, strerror(errno));
if (ioctl(dest_fd, FICLONE, src_fd) < 0)
- pg_fatal("could not clone file between old and new data directories: %s\n",
+ pg_fatal("could not clone file between old and new data directories: %s",
strerror(errno));
close(src_fd);
close(dest_fd);
}
#else
- pg_fatal("file cloning not supported on this platform\n");
+ pg_fatal("file cloning not supported on this platform");
#endif
unlink(new_link_file);
if (link(existing_file, new_link_file) < 0)
pg_fatal("could not create hard link between old and new data directories: %s\n"
- "In link mode the old and new data directories must be on the same file system.\n",
+ "In link mode the old and new data directories must be on the same file system.",
strerror(errno));
unlink(new_link_file);
was_load_failure = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
output_path, strerror(errno));
fprintf(script, _("could not load library \"%s\": %s"),
lib,
if (found)
{
fclose(script);
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation references loadable libraries that are missing from the\n"
"new installation. You can add these libraries to the new installation,\n"
"or remove the functions using them from the old installation. A list of\n"
"problem libraries is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
strcmp(old_rel->relname, new_rel->relname) != 0)
{
pg_log(PG_WARNING, "Relation names for OID %u in database \"%s\" do not match: "
- "old name \"%s.%s\", new name \"%s.%s\"\n",
+ "old name \"%s.%s\", new name \"%s.%s\"",
old_rel->reloid, old_db->db_name,
old_rel->nspname, old_rel->relname,
new_rel->nspname, new_rel->relname);
}
if (!all_matched)
- pg_fatal("Failed to match up old and new tables in database \"%s\"\n",
+ pg_fatal("Failed to match up old and new tables in database \"%s\"",
old_db->db_name);
*nmaps = num_maps;
}
if (is_new_db)
- pg_log(PG_WARNING, "No match found in old cluster for new relation with OID %u in database \"%s\": %s\n",
+ pg_log(PG_WARNING, "No match found in old cluster for new relation with OID %u in database \"%s\": %s",
reloid, db->db_name, reldesc);
else
- pg_log(PG_WARNING, "No match found in new cluster for old relation with OID %u in database \"%s\": %s\n",
+ pg_log(PG_WARNING, "No match found in new cluster for old relation with OID %u in database \"%s\": %s",
reloid, db->db_name, reldesc);
}
get_rel_infos(cluster, &cluster->dbarr.dbs[dbnum]);
if (cluster == &old_cluster)
- pg_log(PG_VERBOSE, "\nsource databases:\n");
+ pg_log(PG_VERBOSE, "\nsource databases:");
else
- pg_log(PG_VERBOSE, "\ntarget databases:\n");
+ pg_log(PG_VERBOSE, "\ntarget databases:");
if (log_opts.verbose)
print_db_infos(&cluster->dbarr);
for (dbnum = 0; dbnum < db_arr->ndbs; dbnum++)
{
- pg_log(PG_VERBOSE, "Database: %s\n", db_arr->dbs[dbnum].db_name);
+ pg_log(PG_VERBOSE, "Database: %s", db_arr->dbs[dbnum].db_name);
print_rel_infos(&db_arr->dbs[dbnum].rel_arr);
- pg_log(PG_VERBOSE, "\n\n");
}
}
int relnum;
for (relnum = 0; relnum < rel_arr->nrels; relnum++)
- pg_log(PG_VERBOSE, "relname: %s.%s: reloid: %u reltblspace: %s\n",
+ pg_log(PG_VERBOSE, "relname: %s.%s: reloid: %u reltblspace: %s",
rel_arr->rels[relnum].nspname,
rel_arr->rels[relnum].relname,
rel_arr->rels[relnum].reloid,
/* Allow help and version to be run as root, so do the test here. */
if (os_user_effective_id == 0)
- pg_fatal("%s: cannot be run as root\n", os_info.progname);
+ pg_fatal("%s: cannot be run as root", os_info.progname);
while ((option = getopt_long(argc, argv, "d:D:b:B:cj:kNo:O:p:P:rs:U:v",
long_options, &optindex)) != -1)
case 'p':
if ((old_cluster.port = atoi(optarg)) <= 0)
- pg_fatal("invalid old port number\n");
+ pg_fatal("invalid old port number");
break;
case 'P':
if ((new_cluster.port = atoi(optarg)) <= 0)
- pg_fatal("invalid new port number\n");
+ pg_fatal("invalid new port number");
break;
case 'r':
}
if (optind < argc)
- pg_fatal("too many command-line arguments (first is \"%s\")\n", argv[optind]);
+ pg_fatal("too many command-line arguments (first is \"%s\")", argv[optind]);
if (log_opts.verbose)
- pg_log(PG_REPORT, "Running in verbose mode\n");
+ pg_log(PG_REPORT, "Running in verbose mode");
log_opts.isatty = isatty(fileno(stdout));
canonicalize_path(new_cluster_pgdata);
if (!getcwd(cwd, MAXPGPATH))
- pg_fatal("could not determine current directory\n");
+ pg_fatal("could not determine current directory");
canonicalize_path(cwd);
if (path_is_prefix_of_path(new_cluster_pgdata, cwd))
- pg_fatal("cannot run pg_upgrade from inside the new cluster data directory on Windows\n");
+ pg_fatal("cannot run pg_upgrade from inside the new cluster data directory on Windows");
}
#endif
}
char cwd[MAXPGPATH];
if (!getcwd(cwd, MAXPGPATH))
- pg_fatal("could not determine current directory\n");
+ pg_fatal("could not determine current directory");
*dirpath = pg_strdup(cwd);
}
else if (missingOk)
return;
else
pg_fatal("You must identify the directory where the %s.\n"
- "Please use the %s command-line option or the %s environment variable.\n",
+ "Please use the %s command-line option or the %s environment variable.",
description, cmdLineOption, envVarName);
}
if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL)
- pg_fatal("could not get data directory using %s: %s\n",
+ pg_fatal("could not get data directory using %s: %s",
cmd, strerror(errno));
pclose(output);
snprintf(filename, sizeof(filename), "%s/postmaster.pid",
cluster->pgdata);
if ((fp = fopen(filename, "r")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n",
+ pg_fatal("could not open file \"%s\": %s",
filename, strerror(errno));
for (lineno = 1;
lineno++)
{
if (fgets(line, sizeof(line), fp) == NULL)
- pg_fatal("could not read line %d from file \"%s\": %s\n",
+ pg_fatal("could not read line %d from file \"%s\": %s",
lineno, filename, strerror(errno));
/* potentially overwrite user-supplied value */
/* warn of port number correction */
if (orig_port != DEF_PGUPORT && old_cluster.port != orig_port)
- pg_log(PG_WARNING, "user-supplied old port number %hu corrected to %hu\n",
+ pg_log(PG_WARNING, "user-supplied old port number %hu corrected to %hu",
orig_port, cluster->port);
}
#else /* !HAVE_UNIX_SOCKETS || WIN32 */
_exit(!exec_prog(log_file, opt_log_file, true, true, "%s", cmd));
else if (child < 0)
/* fork failed */
- pg_fatal("could not create worker process: %s\n", strerror(errno));
+ pg_fatal("could not create worker process: %s", strerror(errno));
#else
/* empty array element are always at the end */
new_arg = exec_thread_args[parallel_jobs - 1];
child = (HANDLE) _beginthreadex(NULL, 0, (void *) win32_exec_prog,
new_arg, 0, NULL);
if (child == 0)
- pg_fatal("could not create worker thread: %s\n", strerror(errno));
+ pg_fatal("could not create worker thread: %s", strerror(errno));
thread_handles[parallel_jobs - 1] = child;
#endif
}
else if (child < 0)
/* fork failed */
- pg_fatal("could not create worker process: %s\n", strerror(errno));
+ pg_fatal("could not create worker process: %s", strerror(errno));
#else
/* empty array element are always at the end */
new_arg = transfer_thread_args[parallel_jobs - 1];
child = (HANDLE) _beginthreadex(NULL, 0, (void *) win32_transfer_all_new_dbs,
new_arg, 0, NULL);
if (child == 0)
- pg_fatal("could not create worker thread: %s\n", strerror(errno));
+ pg_fatal("could not create worker thread: %s", strerror(errno));
thread_handles[parallel_jobs - 1] = child;
#endif
#ifndef WIN32
child = waitpid(-1, &work_status, wait_for_child ? 0 : WNOHANG);
if (child == (pid_t) -1)
- pg_fatal("%s() failed: %s\n", "waitpid", strerror(errno));
+ pg_fatal("%s() failed: %s", "waitpid", strerror(errno));
if (child == 0)
return false; /* no children, or no dead children */
if (work_status != 0)
- pg_fatal("child process exited abnormally: status %d\n", work_status);
+ pg_fatal("child process exited abnormally: status %d", work_status);
#else
/* wait for one to finish */
thread_num = WaitForMultipleObjects(parallel_jobs, thread_handles,
/* get the result */
GetExitCodeThread(thread_handles[thread_num], &res);
if (res != 0)
- pg_fatal("child worker exited abnormally: %s\n", strerror(errno));
+ pg_fatal("child worker exited abnormally: %s", strerror(errno));
/* dispose of handle to stop leaks */
CloseHandle(thread_handles[thread_num]);
char *deletion_script_file_name = NULL;
bool live_check = false;
+ /*
+ * pg_upgrade doesn't currently use common/logging.c, but initialize it
+ * anyway because we might call common code that does.
+ */
pg_logging_init(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_upgrade"));
* output directories with correct permissions.
*/
if (!GetDataDirectoryCreatePerm(new_cluster.pgdata))
- pg_fatal("could not read permissions of directory \"%s\": %s\n",
+ pg_fatal("could not read permissions of directory \"%s\": %s",
new_cluster.pgdata, strerror(errno));
umask(pg_mode_mask);
pg_log(PG_REPORT,
"\n"
"Performing Upgrade\n"
- "------------------\n");
+ "------------------");
prepare_new_cluster();
pg_log(PG_REPORT,
"\n"
"Upgrade Complete\n"
- "----------------\n");
+ "----------------");
output_completion_banner(deletion_script_file_name);
log_opts.rootdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.rootdir, MAXPGPATH, "%s/%s", pgdata, BASE_OUTPUTDIR);
if (len >= MAXPGPATH)
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
/* BASE_OUTPUTDIR/$timestamp/ */
gettimeofday(&time, NULL);
len = snprintf(log_opts.basedir, MAXPGPATH, "%s/%s", log_opts.rootdir,
timebuf);
if (len >= MAXPGPATH)
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
/* BASE_OUTPUTDIR/$timestamp/dump/ */
log_opts.dumpdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.dumpdir, MAXPGPATH, "%s/%s/%s", log_opts.rootdir,
timebuf, DUMP_OUTPUTDIR);
if (len >= MAXPGPATH)
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
/* BASE_OUTPUTDIR/$timestamp/log/ */
log_opts.logdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.logdir, MAXPGPATH, "%s/%s/%s", log_opts.rootdir,
timebuf, LOG_OUTPUTDIR);
if (len >= MAXPGPATH)
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
/*
* Ignore the error case where the root path exists, as it is kept the
* same across runs.
*/
if (mkdir(log_opts.rootdir, pg_dir_create_mode) < 0 && errno != EEXIST)
- pg_fatal("could not create directory \"%s\": %m\n", log_opts.rootdir);
+ pg_fatal("could not create directory \"%s\": %m", log_opts.rootdir);
if (mkdir(log_opts.basedir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n", log_opts.basedir);
+ pg_fatal("could not create directory \"%s\": %m", log_opts.basedir);
if (mkdir(log_opts.dumpdir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n", log_opts.dumpdir);
+ pg_fatal("could not create directory \"%s\": %m", log_opts.dumpdir);
if (mkdir(log_opts.logdir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n", log_opts.logdir);
+ pg_fatal("could not create directory \"%s\": %m", log_opts.logdir);
len = snprintf(filename_path, sizeof(filename_path), "%s/%s",
log_opts.logdir, INTERNAL_LOG_FILE);
if (len >= sizeof(filename_path))
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
if ((log_opts.internal = fopen_priv(filename_path, "a")) == NULL)
- pg_fatal("could not open log file \"%s\": %m\n", filename_path);
+ pg_fatal("could not open log file \"%s\": %m", filename_path);
/* label start of upgrade in logfiles */
for (filename = output_files; *filename != NULL; filename++)
len = snprintf(filename_path, sizeof(filename_path), "%s/%s",
log_opts.logdir, *filename);
if (len >= sizeof(filename_path))
- pg_fatal("directory path for new cluster is too long\n");
+ pg_fatal("directory path for new cluster is too long");
if ((fp = fopen_priv(filename_path, "a")) == NULL)
- pg_fatal("could not write to log file \"%s\": %m\n", filename_path);
+ pg_fatal("could not write to log file \"%s\": %m", filename_path);
fprintf(fp,
"-----------------------------------------------------------------\n"
char exec_path[MAXPGPATH];
if (find_my_exec(argv0, exec_path) < 0)
- pg_fatal("%s: could not find own program executable\n", argv0);
+ pg_fatal("%s: could not find own program executable", argv0);
/* Trim off program name and keep just path */
*last_dir_separator(exec_path) = '\0';
canonicalize_path(exec_path);
{
if (!user_opts.check)
pg_fatal("There seems to be a postmaster servicing the old cluster.\n"
- "Please shutdown that postmaster and try again.\n");
+ "Please shutdown that postmaster and try again.");
else
*live_check = true;
}
stop_postmaster(false);
else
pg_fatal("There seems to be a postmaster servicing the new cluster.\n"
- "Please shutdown that postmaster and try again.\n");
+ "Please shutdown that postmaster and try again.");
}
}
snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
if (!rmtree(new_path, rmtopdir))
- pg_fatal("could not delete directory \"%s\"\n", new_path);
+ pg_fatal("could not delete directory \"%s\"", new_path);
check_ok();
}
typedef enum
{
PG_VERBOSE,
- PG_STATUS,
+ PG_STATUS, /* these messages do not get a newline added */
+ PG_REPORT_NONL, /* these too */
PG_REPORT,
PG_WARNING,
PG_FATAL
}
if (new_dbnum >= new_db_arr->ndbs)
- pg_fatal("old database \"%s\" not found in the new cluster\n",
+ pg_fatal("old database \"%s\" not found in the new cluster",
old_db->db_name);
mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata,
if (errno == ENOENT)
return;
else
- pg_fatal("error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
+ pg_fatal("error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %s",
map->nspname, map->relname, old_file, new_file,
strerror(errno));
}
if (vm_must_add_frozenbit && strcmp(type_suffix, "_vm") == 0)
{
/* Need to rewrite visibility map format */
- pg_log(PG_VERBOSE, "rewriting \"%s\" to \"%s\"\n",
+ pg_log(PG_VERBOSE, "rewriting \"%s\" to \"%s\"",
old_file, new_file);
rewriteVisibilityMap(old_file, new_file, map->nspname, map->relname);
}
switch (user_opts.transfer_mode)
{
case TRANSFER_MODE_CLONE:
- pg_log(PG_VERBOSE, "cloning \"%s\" to \"%s\"\n",
+ pg_log(PG_VERBOSE, "cloning \"%s\" to \"%s\"",
old_file, new_file);
cloneFile(old_file, new_file, map->nspname, map->relname);
break;
case TRANSFER_MODE_COPY:
- pg_log(PG_VERBOSE, "copying \"%s\" to \"%s\"\n",
+ pg_log(PG_VERBOSE, "copying \"%s\" to \"%s\"",
old_file, new_file);
copyFile(old_file, new_file, map->nspname, map->relname);
break;
case TRANSFER_MODE_LINK:
- pg_log(PG_VERBOSE, "linking \"%s\" to \"%s\"\n",
+ pg_log(PG_VERBOSE, "linking \"%s\" to \"%s\"",
old_file, new_file);
linkFile(old_file, new_file, map->nspname, map->relname);
}
vsnprintf(query, sizeof(query), fmt, args);
va_end(args);
- pg_log(PG_VERBOSE, "executing: %s\n", query);
+ pg_log(PG_VERBOSE, "executing: %s", query);
result = PQexec(conn, query);
status = PQresultStatus(result);
snprintf(ver_filename, sizeof(ver_filename), "%s/PG_VERSION",
cluster->pgdata);
if ((version_fd = fopen(ver_filename, "r")) == NULL)
- pg_fatal("could not open version file \"%s\": %m\n", ver_filename);
+ pg_fatal("could not open version file \"%s\": %m", ver_filename);
if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 ||
sscanf(cluster->major_version_str, "%d.%d", &v1, &v2) < 1)
- pg_fatal("could not parse version file \"%s\"\n", ver_filename);
+ pg_fatal("could not parse version file \"%s\"", ver_filename);
fclose(version_fd);
PQfinish(conn);
if (cluster == &old_cluster)
pg_fatal("could not connect to source postmaster started with the command:\n"
- "%s\n",
+ "%s",
cmd);
else
pg_fatal("could not connect to target postmaster started with the command:\n"
- "%s\n",
+ "%s",
cmd);
}
PQfinish(conn);
if (!pg_ctl_return)
{
if (cluster == &old_cluster)
- pg_fatal("pg_ctl failed to start the source server, or connection failed\n");
+ pg_fatal("pg_ctl failed to start the source server, or connection failed");
else
- pg_fatal("pg_ctl failed to start the target server, or connection failed\n");
+ pg_fatal("pg_ctl failed to start the target server, or connection failed");
}
return true;
start = PQconndefaults();
if (!start)
- pg_fatal("out of memory\n");
+ pg_fatal("out of memory");
for (option = start; option->keyword != NULL; option++)
{
/* check for 'local' host values */
(strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 &&
strcmp(value, "::1") != 0 && !is_unixsock_path(value)))
- pg_fatal("libpq environment variable %s has a non-local server value: %s\n",
+ pg_fatal("libpq environment variable %s has a non-local server value: %s",
option->envvar, value);
}
}
if (os_info.num_old_tablespaces > 0 &&
strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0)
pg_fatal("Cannot upgrade to/from the same system catalog version when\n"
- "using tablespaces.\n");
+ "using tablespaces.");
}
{
if (errno == ENOENT)
report_status(PG_FATAL,
- "tablespace directory \"%s\" does not exist\n",
+ "tablespace directory \"%s\" does not exist",
os_info.old_tablespaces[tblnum]);
else
report_status(PG_FATAL,
- "could not stat tablespace directory \"%s\": %s\n",
+ "could not stat tablespace directory \"%s\": %s",
os_info.old_tablespaces[tblnum], strerror(errno));
}
if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL,
- "tablespace path \"%s\" is not a directory\n",
+ "tablespace path \"%s\" is not a directory",
os_info.old_tablespaces[tblnum]);
}
* report_status()
*
* Displays the result of an operation (ok, failed, error message,...)
+ *
+ * This is no longer functionally different from pg_log(), but we keep
+ * it around to maintain a notational distinction between operation
+ * results and other messages.
*/
void
report_status(eLogType type, const char *fmt,...)
{
va_list args;
- char message[MAX_STRING];
va_start(args, fmt);
- vsnprintf(message, sizeof(message), fmt, args);
+ pg_log_v(type, fmt, args);
va_end(args);
-
- pg_log(type, "%s\n", message);
}
if (log_opts.isatty)
{
printf("\r");
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, "");
+ pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");
}
else if (log_opts.verbose)
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, "");
+ pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");
}
/*
default:
/* different failure, just report it */
- pg_log(PG_WARNING, "could not access directory \"%s\": %m\n",
+ pg_log(PG_WARNING, "could not access directory \"%s\": %m",
log_opts.rootdir);
break;
}
* prep_status
*
* Displays a message that describes an operation we are about to begin.
- * We pad the message out to MESSAGE_WIDTH characters so that all of the "ok" and
- * "failed" indicators line up nicely.
+ * We pad the message out to MESSAGE_WIDTH characters so that all of the
+ * "ok" and "failed" indicators line up nicely. (Overlength messages
+ * will be truncated, so don't get too verbose.)
*
* A typical sequence would look like this:
- * prep_status("about to flarb the next %d files", fileCount );
- *
- * if(( message = flarbFiles(fileCount)) == NULL)
- * report_status(PG_REPORT, "ok" );
+ * prep_status("about to flarb the next %d files", fileCount);
+ * if ((message = flarbFiles(fileCount)) == NULL)
+ * report_status(PG_REPORT, "ok");
* else
- * pg_log(PG_FATAL, "failed - %s\n", message );
+ * pg_log(PG_FATAL, "failed: %s", message);
*/
void
prep_status(const char *fmt,...)
va_end(args);
/* trim strings */
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);
+ pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);
}
/*
* put the individual progress items onto the next line.
*/
if (log_opts.isatty || log_opts.verbose)
- pg_log(PG_REPORT, "%-*s\n", MESSAGE_WIDTH, message);
- else
pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);
+ else
+ pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);
}
static void
{
char message[QUERY_ALLOC];
+ /* No incoming message should end in newline; we add that here. */
+ Assert(fmt);
+ Assert(fmt[0] == '\0' || fmt[strlen(fmt) - 1] != '\n');
+
vsnprintf(message, sizeof(message), _(fmt), ap);
/* PG_VERBOSE and PG_STATUS are only output in verbose mode */
log_opts.internal != NULL)
{
if (type == PG_STATUS)
- /* status messages need two leading spaces and a newline */
+ /* status messages get two leading spaces, see below */
fprintf(log_opts.internal, " %s\n", message);
- else
+ else if (type == PG_REPORT_NONL)
fprintf(log_opts.internal, "%s", message);
+ else
+ fprintf(log_opts.internal, "%s\n", message);
fflush(log_opts.internal);
}
{
case PG_VERBOSE:
if (log_opts.verbose)
- printf("%s", message);
+ printf("%s\n", message);
break;
case PG_STATUS:
/*
- * For output to a display, do leading truncation. Append \r so
- * that the next message is output at the start of the line.
+ * For output to a terminal, we add two leading spaces and no
+ * newline; instead append \r so that the next message is output
+ * on the same line. Truncate on the left to fit into
+ * MESSAGE_WIDTH (counting the spaces as part of that).
*
* If going to non-interactive output, only display progress if
* verbose is enabled. Otherwise the output gets unreasonably
* large by default.
*/
if (log_opts.isatty)
- /* -2 because we use a 2-space indent */
- printf(" %s%-*.*s\r",
+ {
+ bool itfits = (strlen(message) <= MESSAGE_WIDTH - 2);
+
/* prefix with "..." if we do leading truncation */
- strlen(message) <= MESSAGE_WIDTH - 2 ? "" : "...",
+ printf(" %s%-*.*s\r",
+ itfits ? "" : "...",
MESSAGE_WIDTH - 2, MESSAGE_WIDTH - 2,
- /* optional leading truncation */
- strlen(message) <= MESSAGE_WIDTH - 2 ? message :
+ itfits ? message :
message + strlen(message) - MESSAGE_WIDTH + 3 + 2);
+ }
else if (log_opts.verbose)
printf(" %s\n", message);
break;
+ case PG_REPORT_NONL:
+ /* This option is for use by prep_status and friends */
+ printf("%s", message);
+ break;
+
case PG_REPORT:
case PG_WARNING:
- printf("%s", message);
+ printf("%s\n", message);
break;
case PG_FATAL:
- printf("\n%s", message);
+ /* Extra newline in case we're interrupting status output */
+ printf("\n%s\n", message);
printf(_("Failure, exiting\n"));
exit(1);
break;
- default:
- break;
+ /* No default:, we want a warning for omitted cases */
}
fflush(stdout);
}
va_start(args, fmt);
pg_log_v(PG_FATAL, fmt, args);
va_end(args);
+ /* NOTREACHED */
printf(_("Failure, exiting\n"));
exit(1);
}
{
/* all seems well */
report_status(PG_REPORT, "ok");
- fflush(stdout);
}
user_name = get_user_name(&errstr);
if (!user_name)
- pg_fatal("%s\n", errstr);
+ pg_fatal("%s", errstr);
/* make a copy */
*user_name_p = pg_strdup(user_name);
{
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n", output_path,
+ pg_fatal("could not open file \"%s\": %s", output_path,
strerror(errno));
if (!db_used)
{
if (check_for_data_type_usage(cluster, "pg_catalog.line", output_path))
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains the \"line\" data type in user tables.\n"
"This data type changed its internal and input/output format\n"
"between your old and new versions so this\n"
"cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (check_for_data_type_usage(cluster, "pg_catalog.unknown", output_path))
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains the \"unknown\" data type in user tables.\n"
"This data type is no longer allowed in tables, so this\n"
"cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
if (!check_mode)
{
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n", output_path,
+ pg_fatal("could not open file \"%s\": %s", output_path,
strerror(errno));
if (!db_used)
{
"Your installation contains hash indexes. These indexes have different\n"
"internal formats between your old and new clusters, so they must be\n"
"reindexed with the REINDEX command. After upgrading, you will be given\n"
- "REINDEX instructions.\n\n");
+ "REINDEX instructions.");
else
pg_log(PG_WARNING, "\n"
"Your installation contains hash indexes. These indexes have different\n"
"reindexed with the REINDEX command. The file\n"
" %s\n"
"when executed by psql by the database superuser will recreate all invalid\n"
- "indexes; until then, none of these indexes will be used.\n\n",
+ "indexes; until then, none of these indexes will be used.",
output_path);
}
else
if (check_for_data_type_usage(cluster, "information_schema.sql_identifier",
output_path))
{
- pg_log(PG_REPORT, "fatal\n");
+ pg_log(PG_REPORT, "fatal");
pg_fatal("Your installation contains the \"sql_identifier\" data type in user tables.\n"
"The on-disk format for this data type has changed, so this\n"
"cluster cannot currently be upgraded. You can\n"
"drop the problem columns and restart the upgrade.\n"
"A list of the problem columns is in the file:\n"
- " %s\n\n", output_path);
+ " %s", output_path);
}
else
check_ok();
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n", output_path,
+ pg_fatal("could not open file \"%s\": %s", output_path,
strerror(errno));
if (!db_used)
{
"with the ALTER EXTENSION command. The file\n"
" %s\n"
"when executed by psql by the database superuser will update\n"
- "these extensions.\n\n",
+ "these extensions.",
output_path);
}
else