Skip to content

Commit e7d56ae

Browse files
committed
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.
1 parent 4bd371f commit e7d56ae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contrib/pg_upgrade/option.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
static void usage(void);
2626
static void check_required_directory(char **dirpath, char **configpath,
2727
char *envVarName, char *cmdLineOption, char *description);
28+
#define FIX_DEFAULT_READ_ONLY "-c default_transaction_read_only=false"
2829

2930

3031
UserOpts user_opts;
@@ -208,6 +209,17 @@ parseCommandLine(int argc, char *argv[])
208209
fclose(fp);
209210
}
210211

212+
/* Turn off read-only mode; add prefix to PGOPTIONS? */
213+
if (getenv("PGOPTIONS"))
214+
{
215+
char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
216+
getenv("PGOPTIONS"));
217+
pg_putenv("PGOPTIONS", pgoptions);
218+
pfree(pgoptions);
219+
}
220+
else
221+
pg_putenv("PGOPTIONS", FIX_DEFAULT_READ_ONLY);
222+
211223
/* Get values from env if not already set */
212224
check_required_directory(&old_cluster.bindir, NULL, "PGBINOLD", "-b",
213225
"old cluster binaries reside");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy