]> granicus.if.org Git - postgresql/commitdiff
pg_upgrade: Handle default_transaction_read_only settings
authorBruce Momjian <bruce@momjian.us>
Sat, 30 Nov 2013 21:50:33 +0000 (16:50 -0500)
committerBruce Momjian <bruce@momjian.us>
Sat, 30 Nov 2013 21:50:33 +0000 (16:50 -0500)
Setting default_transaction_read_only=true could prevent pg_upgrade from
completing, so prepend default_transaction_read_only=false to
PGOPTIONS.

contrib/pg_upgrade/option.c

index 250aeb8e1a1543f5018631c628c251ea76f84f0d..6bd91c5230139917b493762eedb0f515a637aef4 100644 (file)
@@ -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");