[PATCH] pg_upgrade -o/-O regression in 9.2.2
Hi!
It seems that PostgreSQL 9.2.2 has a regression in pg_upgrade, the -o
and -O options forget to add a space before passing on user options,
thereby generating unparsable command lines.
For example:
pg_upgrade -b /usr/local/pg91/bin -B /usr/bin -d /tmp/91 -D /tmp/92 -O -F
[...]
Creating catalog dump ok
*failure*
could not connect to new postmaster started with the command:
"/usr/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/tmp/92" -o "-p
50432 -b -c synchronous_commit=off-F -c listen_addresses='' -c
unix_socket_permissions=0700 -c unix_socket_directory='/tmp'" start
Notice the bad argument "synchronous_commit=off-F"
It's easy enough to work around by adding a space to the command line,
passing -O ' -F' instead of -O '-F'
Here's the bad commit:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=ed5699dd1b883e193930448b7ad532e233de0bd7;hp=5ed6546cf75623ba426942a3b71659a66cf7ed68
The attached patch re-introduces the space at the necessary place.
Regards,
Marti
Attachments:
pg_upgrade_user_options-9.2.patchapplication/octet-stream; name=pg_upgrade_user_options-9.2.patchDownload
From b137edaed1ce16763644d0d6415ab702aef1946a Mon Sep 17 00:00:00 2001
From: Marti Raudsepp <marti@juffo.org>
Date: Mon, 10 Dec 2012 23:52:24 +0200
Subject: [PATCH] pg_upgrade: fix handling of -O/-o arguments, need space
before user options
---
contrib/pg_upgrade/server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c
index 49d4c8f..0940e00 100644
--- a/contrib/pg_upgrade/server.c
+++ b/contrib/pg_upgrade/server.c
@@ -214,7 +214,7 @@ start_postmaster(ClusterInfo *cluster)
* the new cluster has to be recreated anyway.
*/
snprintf(cmd, sizeof(cmd),
- "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s%s%s\" start",
+ "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s\" start",
cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
(cluster->controldata.cat_ver >=
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? " -b" :
--
1.8.0.1
On Tue, Dec 11, 2012 at 12:17:11AM +0200, Marti Raudsepp wrote:
Hi!
It seems that PostgreSQL 9.2.2 has a regression in pg_upgrade, the -o
and -O options forget to add a space before passing on user options,
thereby generating unparsable command lines.For example:
pg_upgrade -b /usr/local/pg91/bin -B /usr/bin -d /tmp/91 -D /tmp/92 -O -F
[...]
Creating catalog dump ok
*failure*
could not connect to new postmaster started with the command:
"/usr/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/tmp/92" -o "-p
50432 -b -c synchronous_commit=off-F -c listen_addresses='' -c
unix_socket_permissions=0700 -c unix_socket_directory='/tmp'" startNotice the bad argument "synchronous_commit=off-F"
It's easy enough to work around by adding a space to the command line,
passing -O ' -F' instead of -O '-F'Here's the bad commit:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=ed5699dd1b883e193930448b7ad532e233de0bd7;hp=5ed6546cf75623ba426942a3b71659a66cf7ed68The attached patch re-introduces the space at the necessary place.
I was super-paranoid about making any changes in that area, but it seems
I wasn't paranoid enough.
Patch applied to head and 9.2. Thanks for the workaround idea too.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers