Skip to content

Commit d2e4bf6

Browse files
committed
Remove -o option to postmaster
This option was declared obsolete many years ago. Reviewed-By: Tom Lane Discussion: https://postgr.es/m/CABUevEyOE=9CQwZm2j=vwP5+6OLCSoxn9pBjK8gyRdkTzMfqtQ@mail.gmail.com
1 parent 6c57f2e commit d2e4bf6

File tree

4 files changed

+6
-93
lines changed

4 files changed

+6
-93
lines changed

doc/src/sgml/ref/postgres-ref.sgml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -280,32 +280,6 @@ PostgreSQL documentation
280280
</listitem>
281281
</varlistentry>
282282

283-
<varlistentry>
284-
<term><option>-o <replaceable class="parameter">extra-options</replaceable></option></term>
285-
<listitem>
286-
<para>
287-
The command-line-style arguments specified in <replaceable
288-
class="parameter">extra-options</replaceable> are passed to
289-
all server processes started by this
290-
<command>postgres</command> process.
291-
</para>
292-
293-
<para>
294-
Spaces within <replaceable class="parameter">extra-options</replaceable> are
295-
considered to separate arguments, unless escaped with a backslash
296-
(<literal>\</literal>); write <literal>\\</literal> to represent a literal
297-
backslash. Multiple arguments can also be specified via multiple
298-
uses of <option>-o</option>.
299-
</para>
300-
301-
<para>
302-
The use of this option is obsolete; all command-line options
303-
for server processes can be specified directly on the
304-
<command>postgres</command> command line.
305-
</para>
306-
</listitem>
307-
</varlistentry>
308-
309283
<varlistentry>
310284
<term><option>-p <replaceable class="parameter">port</replaceable></option></term>
311285
<listitem>

src/backend/main/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ help(const char *progname)
323323
printf(_(" -l enable SSL connections\n"));
324324
#endif
325325
printf(_(" -N MAX-CONNECT maximum number of allowed connections\n"));
326-
printf(_(" -o OPTIONS pass \"OPTIONS\" to each server process (obsolete)\n"));
327326
printf(_(" -p PORT port number to listen on\n"));
328327
printf(_(" -s show statistics after each query\n"));
329328
printf(_(" -S WORK-MEM set amount of memory for sorts (in kB)\n"));

src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
#include "libpq/libpq.h"
106106
#include "libpq/pqformat.h"
107107
#include "libpq/pqsignal.h"
108-
#include "miscadmin.h"
109108
#include "pg_getopt.h"
110109
#include "pgstat.h"
111110
#include "port/pg_bswap.h"
@@ -219,12 +218,6 @@ int ReservedBackends;
219218
/* The socket(s) we're listening to. */
220219
#define MAXLISTEN 64
221220
static pgsocket ListenSocket[MAXLISTEN];
222-
223-
/*
224-
* Set by the -o option
225-
*/
226-
static char ExtraOptions[MAXPGPATH];
227-
228221
/*
229222
* These globals control the behavior of the postmaster in case some
230223
* backend dumps core. Normally, it kills all peers of the dead backend
@@ -537,7 +530,6 @@ typedef struct
537530
#endif
538531
char my_exec_path[MAXPGPATH];
539532
char pkglib_path[MAXPGPATH];
540-
char ExtraOptions[MAXPGPATH];
541533
} BackendParameters;
542534

543535
static void read_backend_variables(char *id, Port *port);
@@ -694,7 +686,7 @@ PostmasterMain(int argc, char *argv[])
694686
* tcop/postgres.c (the option sets should not conflict) and with the
695687
* common help() function in main/main.c.
696688
*/
697-
while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
689+
while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:W:-:")) != -1)
698690
{
699691
switch (opt)
700692
{
@@ -773,13 +765,6 @@ PostmasterMain(int argc, char *argv[])
773765
SetConfigOption("allow_system_table_mods", "true", PGC_POSTMASTER, PGC_S_ARGV);
774766
break;
775767

776-
case 'o':
777-
/* Other options to pass to the backend on the command line */
778-
snprintf(ExtraOptions + strlen(ExtraOptions),
779-
sizeof(ExtraOptions) - strlen(ExtraOptions),
780-
" %s", optarg);
781-
break;
782-
783768
case 'P':
784769
SetConfigOption("ignore_system_indexes", "true", PGC_POSTMASTER, PGC_S_ARGV);
785770
break;
@@ -4489,48 +4474,11 @@ BackendInitialize(Port *port)
44894474
static void
44904475
BackendRun(Port *port)
44914476
{
4492-
char **av;
4493-
int maxac;
4494-
int ac;
4495-
int i;
4477+
char *av[2];
4478+
const int ac = 1;
44964479

4497-
/*
4498-
* Now, build the argv vector that will be given to PostgresMain.
4499-
*
4500-
* The maximum possible number of commandline arguments that could come
4501-
* from ExtraOptions is (strlen(ExtraOptions) + 1) / 2; see
4502-
* pg_split_opts().
4503-
*/
4504-
maxac = 2; /* for fixed args supplied below */
4505-
maxac += (strlen(ExtraOptions) + 1) / 2;
4506-
4507-
av = (char **) MemoryContextAlloc(TopMemoryContext,
4508-
maxac * sizeof(char *));
4509-
ac = 0;
4510-
4511-
av[ac++] = "postgres";
4512-
4513-
/*
4514-
* Pass any backend switches specified with -o on the postmaster's own
4515-
* command line. We assume these are secure.
4516-
*/
4517-
pg_split_opts(av, &ac, ExtraOptions);
4518-
4519-
av[ac] = NULL;
4520-
4521-
Assert(ac < maxac);
4522-
4523-
/*
4524-
* Debug: print arguments being passed to backend
4525-
*/
4526-
ereport(DEBUG3,
4527-
(errmsg_internal("%s child[%d]: starting with (",
4528-
progname, (int) getpid())));
4529-
for (i = 0; i < ac; ++i)
4530-
ereport(DEBUG3,
4531-
(errmsg_internal("\t%s", av[i])));
4532-
ereport(DEBUG3,
4533-
(errmsg_internal(")")));
4480+
av[0] = "postgres";
4481+
av[1] = NULL;
45344482

45354483
/*
45364484
* Make sure we aren't in PostmasterContext anymore. (We can't delete it
@@ -6253,8 +6201,6 @@ save_backend_variables(BackendParameters *param, Port *port,
62536201

62546202
strlcpy(param->pkglib_path, pkglib_path, MAXPGPATH);
62556203

6256-
strlcpy(param->ExtraOptions, ExtraOptions, MAXPGPATH);
6257-
62586204
return true;
62596205
}
62606206

@@ -6485,8 +6431,6 @@ restore_backend_variables(BackendParameters *param, Port *port)
64856431

64866432
strlcpy(pkglib_path, param->pkglib_path, MAXPGPATH);
64876433

6488-
strlcpy(ExtraOptions, param->ExtraOptions, MAXPGPATH);
6489-
64906434
/*
64916435
* We need to restore fd.c's counts of externally-opened FDs; to avoid
64926436
* confusion, be sure to do this after restoring max_safe_fds. (Note:

src/backend/tcop/postgres.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
35543554
* postmaster/postmaster.c (the option sets should not conflict) and with
35553555
* the common help() function in main/main.c.
35563556
*/
3557-
while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1)
3557+
while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:v:W:-:")) != -1)
35583558
{
35593559
switch (flag)
35603560
{
@@ -3632,10 +3632,6 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
36323632
SetConfigOption("allow_system_table_mods", "true", ctx, gucsource);
36333633
break;
36343634

3635-
case 'o':
3636-
errs++;
3637-
break;
3638-
36393635
case 'P':
36403636
SetConfigOption("ignore_system_indexes", "true", ctx, gucsource);
36413637
break;

0 commit comments

Comments
 (0)