Bruce Momjian wrote:

I ran some tests using XP "CMD" and found:


works but:


does not work. Since I see that the output always has a leading path,

On Windows, pgpath is guaranteed to be a full path (see call to expanded_path() ) exactly so it works inside quotes using the Windows command processor.

have modified the code to do:

   printf("\nSuccess. You can now start the database server using:\n\n"
          "    %s%s%s/postmaster -D %s%s%s\n"
          "    %s%s%s/pg_ctl -D %s%s%s -l logfile start\n\n",
           QUOTE_PATH, pgpath, QUOTE_PATH, QUOTE_PATH, pg_data, QUOTE_PATH,
           QUOTE_PATH, pgpath, QUOTE_PATH, QUOTE_PATH, pg_data, QUOTE_PATH);

I am attaching the updated initdb.c file.

The problem with this is that you now have 2 quoted strings. This is exactly the problem that I solved inside initdb by passing pg_data via the environment rather than on the command line. "help cmd" on XP gives you this info:

If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:

   1.  If all of the following conditions are met, then quote characters
       on the command line are preserved:

       - no /S switch
       - exactly two quote characters
       - no special characters between the two quote characters,
         where special is one of: &<>()@^|
       - there are one or more whitespace characters between the
         the two quote characters
       - the string between the two quote characters is the name
         of an executable file.

   2.  Otherwise, old behavior is to see if the first character is
       a quote character and if so, strip the leading character and
       remove the last quote character on the command line, preserving
       any text after the last quote character.

It is amazingly brain dead and cost me hours and hours of grief trying to work out WTF was going on.

Offhand I can't think of a simple guaranteed to work command line for the Windows message.

In the last resort we might need to look at having initdb create a .bat file or two for us.




---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Reply via email to