Small patch: initdb: "'" for QUOTE_PATH (non-windows)

Started by Ryan Murphyover 9 years ago1 messages
#1Ryan Murphy
ryanfmurphy@gmail.com
1 attachment(s)

Hello Postgres Hackers!

I sent this already a few hours ago but it got blocked because I had not
yet joined the mailing list. Trying again, sorry for any redundancy or
confusion!

This is to fix an issue that came up for me when running initdb.

At the end of a successful initdb it says:

Success. You can now start the database server using:
pg_ctl -D /some/path/to/data -l logfile start

but this command did not work for me because my data directory
contained a space. The src/bin/initdb/initdb.c source code
did already have a QUOTE_PATH constant, but it was the empty
string for non-windows cases.

Therefore, added quotes via existing QUOTE_PATH constant:

pg_ctl -D '/some/path/to/data' -l logfile start

Best,
Ryan

Attachments:

0001-initdb-for-QUOTE_PATH-non-windows.patchapplication/octet-stream; name=0001-initdb-for-QUOTE_PATH-non-windows.patchDownload
From 275d045bc41b136df8c413eedba12fbd21609de1 Mon Sep 17 00:00:00 2001
From: ryanfmurphy <ryanfmurphy@gmail.com>
Date: Sun, 14 Aug 2016 08:56:50 -0500
Subject: [PATCH] initdb: "'" for QUOTE_PATH (non-windows)

fix issue when running initdb

at the end of a successful initdb it says:

Success. You can now start the database server using:
    pg_ctl -D /some/path/to/data -l logfile start

but this command will not work if the data directory contains a space
therefore, added quotes via existing QUOTE_PATH constant:

    pg_ctl -D '/some/path/to/data' -l logfile start
---
 src/bin/initdb/initdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 73cb7ee..6dc1e23 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -332,7 +332,7 @@ do { \
 } while (0)
 
 #ifndef WIN32
-#define QUOTE_PATH	""
+#define QUOTE_PATH	"'"
 #define DIR_SEP "/"
 #else
 #define QUOTE_PATH	"\""
-- 
2.5.4 (Apple Git-61)