diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c index c347484b81d..60d69571092 100644 --- a/contrib/pg_upgrade/exec.c +++ b/contrib/pg_upgrade/exec.c @@ -14,7 +14,7 @@ static void check_data_dir(migratorContext *ctx, const char *pg_data); -static void check_bin_dir(migratorContext *ctx, ClusterInfo *cluster); +static void check_bin_dir(migratorContext *ctx, ClusterInfo *cluster, Cluster whichCluster); static int check_exec(migratorContext *ctx, const char *dir, const char *cmdName); static const char *validate_exec(const char *path); @@ -99,7 +99,7 @@ verify_directories(migratorContext *ctx) check_ok(ctx); prep_status(ctx, "Checking old bin directory (%s)", ctx->old.bindir); - check_bin_dir(ctx, &ctx->old); + check_bin_dir(ctx, &ctx->old, CLUSTER_OLD); check_ok(ctx); prep_status(ctx, "Checking new data directory (%s)", ctx->new.pgdata); @@ -107,7 +107,7 @@ verify_directories(migratorContext *ctx) check_ok(ctx); prep_status(ctx, "Checking new bin directory (%s)", ctx->new.bindir); - check_bin_dir(ctx, &ctx->new); + check_bin_dir(ctx, &ctx->new, CLUSTER_NEW); check_ok(ctx); } @@ -158,12 +158,18 @@ check_data_dir(migratorContext *ctx, const char *pg_data) * exit(). */ static void -check_bin_dir(migratorContext *ctx, ClusterInfo *cluster) +check_bin_dir(migratorContext *ctx, ClusterInfo *cluster, Cluster whichCluster) { check_exec(ctx, cluster->bindir, "postgres"); - check_exec(ctx, cluster->bindir, "psql"); check_exec(ctx, cluster->bindir, "pg_ctl"); - check_exec(ctx, cluster->bindir, "pg_dumpall"); + check_exec(ctx, cluster->bindir, "pg_resetxlog"); + if (whichCluster == CLUSTER_NEW) + { + /* these are only needed in the new cluster */ + check_exec(ctx, cluster->bindir, "pg_config"); + check_exec(ctx, cluster->bindir, "psql"); + check_exec(ctx, cluster->bindir, "pg_dumpall"); + } } diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index d03b978619e..136364f017e 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -308,7 +308,11 @@ validateDirectoryOption(migratorContext *ctx, char **dirpath, static void get_pkglibdirs(migratorContext *ctx) { - ctx->old.libpath = get_pkglibdir(ctx, ctx->old.bindir); + /* + * we do not need to know the libpath in the old cluster, and might not + * have a working pg_config to ask for it anyway. + */ + ctx->old.libpath = NULL; ctx->new.libpath = get_pkglibdir(ctx, ctx->new.bindir); }