On Fri, Nov 22, 2013 at 01:55:10PM -0800, Kevin Grittner wrote:
> Kevin Grittner <kgri...@ymail.com> wrote:
> This covers pg_dumpall globals.  Tested with a read-only postgres
> database and with default_transaction_read_only = on in the
> postgresql.conf file.
> It does nothing about pg_upgrade, which is sort of a separate
> issue.  My inclination is that connections to the new cluster
> should set this and connections to the old should not.

I have fixed pg_upgrade in git-head with the attached patch, which
prepends default_transaction_read_only=false to PGOPTIONS.  I prepended
rather than appended because if PGOPTIONS had
default_transaction_read_only=true, I didn't want to override that. 

While pg_dumpall would override that, that is more of an implementation
detail of having to set the value at the session level, rather than a
desired behavior.

  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
new file mode 100644
index 250aeb8..6bd91c5
*** a/contrib/pg_upgrade/option.c
--- b/contrib/pg_upgrade/option.c
*** 25,30 ****
--- 25,31 ----
  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;
*************** parseCommandLine(int argc, char *argv[])
*** 208,213 ****
--- 209,225 ----
+ 	/* 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
  	/* Get values from env if not already set */
  	check_required_directory(&old_cluster.bindir, NULL, "PGBINOLD", "-b",
  							 "old cluster binaries reside");
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to