From: Bruce Momjian Date: Sat, 30 Nov 2013 21:50:33 +0000 (-0500) Subject: pg_upgrade: Handle default_transaction_read_only settings X-Git-Tag: REL9_4_BETA1~850 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7d56aee2d1805cd9d280c0e6f8c8af80a13aa3e;p=postgresql pg_upgrade: Handle default_transaction_read_only settings Setting default_transaction_read_only=true could prevent pg_upgrade from completing, so prepend default_transaction_read_only=false to PGOPTIONS. --- diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index 250aeb8e1a..6bd91c5230 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -25,6 +25,7 @@ static void usage(void); static void check_required_directory(char **dirpath, char **configpath, char *envVarName, char *cmdLineOption, char *description); +#define FIX_DEFAULT_READ_ONLY "-c default_transaction_read_only=false" UserOpts user_opts; @@ -208,6 +209,17 @@ parseCommandLine(int argc, char *argv[]) fclose(fp); } + /* Turn off read-only mode; add prefix to PGOPTIONS? */ + if (getenv("PGOPTIONS")) + { + char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY, + getenv("PGOPTIONS")); + pg_putenv("PGOPTIONS", pgoptions); + pfree(pgoptions); + } + else + pg_putenv("PGOPTIONS", FIX_DEFAULT_READ_ONLY); + /* Get values from env if not already set */ check_required_directory(&old_cluster.bindir, NULL, "PGBINOLD", "-b", "old cluster binaries reside");