Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)
От | Andres Freund |
---|---|
Тема | Re: Patch: initdb: "'" for QUOTE_PATH (non-windows) |
Дата | |
Msg-id | 20160816230517.vo43steejci6em3q@alap3.anarazel.de обсуждение исходный текст |
Ответ на | Patch: initdb: "'" for QUOTE_PATH (non-windows) (Ryan Murphy <ryanfmurphy@gmail.com>) |
Ответы |
Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)
|
Список | pgsql-hackers |
Hi, On 2016-08-14 10:12:45 -0500, Ryan Murphy wrote: > Hello Postgres Team! > 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 > 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 "\"" ISTM that the correct fix would be to actually introduce something like quote_path_for_shell() which either adds proper quotes, or fails if that'd be hard (e.g. if the path contains quotes, and we're on windows).
В списке pgsql-hackers по дате отправления: