<term><literal>options</literal></term>
<listitem>
<para>
- Adds command-line options to send to the server at run-time.
- For example, setting this to <literal>-c geqo=off</> sets the
+ Specifies command-line options to send to the server at connection
+ start. For example, setting this to <literal>-c geqo=off</> sets the
session's value of the <varname>geqo</> parameter to
- <literal>off</>. For a detailed discussion of the available
+ <literal>off</>. Spaces within this string are considered to
+ separate command-line arguments, unless escaped with a backslash
+ (<literal>\</>); write <literal>\\</> to represent a literal
+ backslash. For a detailed discussion of the available
options, consult <xref linkend="runtime-config">.
</para>
</listitem>
<para>
Command-line arguments for the backend. (This is
deprecated in favor of setting individual run-time
- parameters.)
+ parameters.) Spaces within this string are
+ considered to separate arguments, unless escaped with
+ a backslash (<literal>\</>); write <literal>\\</> to
+ represent a literal backslash.
</para>
</listitem>
</varlistentry>
In addition to the above, any run-time parameter that can be
set at backend start time might be listed. Such settings
will be applied during backend start (after parsing the
- command-line options if any). The values will act as
- session defaults. Spaces in option values need to be escaped
- with a backslash (<literal>\</>). A literal backslash can be
- passed by escaping it with another backslash
- (i.e <literal>\\</>).
+ command-line arguments if any). The values will act as
+ session defaults.
</para>
</listitem>
</varlistentry>
<term><option>-o <replaceable class="parameter">extra-options</replaceable></option></term>
<listitem>
<para>
- The command-line-style options specified in <replaceable
+ The command-line-style arguments specified in <replaceable
class="parameter">extra-options</replaceable> are passed to
all server processes started by this
- <command>postgres</command> process. If the option string contains
- any spaces, the entire string must be quoted; multiple
- option invocations are appended.
+ <command>postgres</command> process.
+ </para>
+
+ <para>
+ Spaces within <replaceable class="parameter">extra-options</> are
+ considered to separate arguments, unless escaped with a backslash
+ (<literal>\</>); write <literal>\\</> to represent a literal
+ backslash. Multiple arguments can also be specified via multiple
+ uses of <option>-o</>.
</para>
<para>
* backslashes, with \\ representing a literal backslash.
*/
void
-pg_split_opts(char **argv, int *argcp, char *optstr)
+pg_split_opts(char **argv, int *argcp, const char *optstr)
{
StringInfoData s;
break;
/*
- * Parse a single option + value, stopping at the first space, unless
- * it's escaped.
+ * Parse a single option, stopping at the first space, unless it's
+ * escaped.
*/
while (*optstr)
{
optstr++;
}
- /* now store the option */
+ /* now store the option in the next argv[] position */
argv[(*argcp)++] = pstrdup(s.data);
}
- resetStringInfo(&s);
+
+ pfree(s.data);
}
/*
*****************************************************************************/
/* in utils/init/postinit.c */
-extern void pg_split_opts(char **argv, int *argcp, char *optstr);
+extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
extern void InitializeMaxBackends(void);
extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username,
Oid useroid, char *out_dbname);