1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

pg_upgrade: Fix exec_prog API to be less flaky

The previous signature made it very easy to pass something other than
the printf-format specifier in the corresponding position, without any
warning from the compiler.

While at it, move some of the escaping, redirecting and quoting
responsibilities from the callers into exec_prog() itself.  This makes
the callsites cleaner.
This commit is contained in:
Alvaro Herrera
2012-08-27 14:21:09 -04:00
parent 34c02044ed
commit 088c065ce8
6 changed files with 96 additions and 113 deletions

View File

@ -23,12 +23,11 @@ generate_old_dump(void)
* --binary-upgrade records the width of dropped columns in pg_class, and
* restores the frozenid's for databases and relations.
*/
exec_prog(true, true, UTILITY_LOG_FILE, NULL,
SYSTEMQUOTE "\"%s/pg_dumpall\" --port %d --username \"%s\" "
"--schema-only --binary-upgrade %s > \"%s\" 2>> \"%s\""
SYSTEMQUOTE, new_cluster.bindir, old_cluster.port, os_info.user,
exec_prog(UTILITY_LOG_FILE, NULL, true,
"\"%s/pg_dumpall\" --port %d --username \"%s\" --schema-only --binary-upgrade %s -f %s",
new_cluster.bindir, old_cluster.port, os_info.user,
log_opts.verbose ? "--verbose" : "",
ALL_DUMP_FILE, UTILITY_LOG_FILE);
ALL_DUMP_FILE);
check_ok();
}