Call for objections: deprecate postmaster -o switch?

Started by Tom Laneover 24 years ago30 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

We had a discussion in late September about deprecating the postmaster's
-o switch in the 7.2 documentation, with an eye to removing it in 7.3:
see thread starting at
http://fts.postgresql.org/db/mw/msg.html?mid=1036935

It wasn't entirely clear to me whether everyone had agreed to the idea
of marking -o deprecated in the 7.2 docs, so here's your chance to
object if you think it's a bad idea...

regards, tom lane

#2Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#1)
Re: Call for objections: deprecate postmaster -o switch?

We had a discussion in late September about deprecating the postmaster's
-o switch in the 7.2 documentation, with an eye to removing it in 7.3:
see thread starting at
http://fts.postgresql.org/db/mw/msg.html?mid=1036935

It wasn't entirely clear to me whether everyone had agreed to the idea
of marking -o deprecated in the 7.2 docs, so here's your chance to
object if you think it's a bad idea...

Is there no overlap in the postgres/postmaster flags?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Is there no overlap in the postgres/postmaster flags?

Yeah, there is. That's why we need to give people warning of what
we intend to break. See prior thread.

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Is there no overlap in the postgres/postmaster flags?

Yeah, there is. That's why we need to give people warning of what
we intend to break. See prior thread.

So we just mention it is going away, but there are duplicates so they
can't start removing -o yet?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#4)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

So we just mention it is going away, but there are duplicates so they
can't start removing -o yet?

Well, we'd have to give a table of recommended translations, eg

-o '-S n' => --sort-mem=n

The translations all exist already, but we've got to start telling
people to quit using the old switches, or we'll never be able to clean
them up.

regards, tom lane

#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#5)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

So we just mention it is going away, but there are duplicates so they
can't start removing -o yet?

Well, we'd have to give a table of recommended translations, eg

-o '-S n' => --sort-mem=n

The translations all exist already, but we've got to start telling
people to quit using the old switches, or we'll never be able to clean
them up.

Yes, now I remember. Do we support long command-line options on all
platforms? I don't think so.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#6)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Yes, now I remember. Do we support long command-line options on all
platforms? I don't think so.

GUC variable assignment works on all platforms.

regards, tom lane

#8Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#7)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Yes, now I remember. Do we support long command-line options on all
platforms? I don't think so.

GUC variable assignment works on all platforms.

OK, but when we recommend, we had better tell them to start using GUC
and not long command-line options _unless_ long options are supported on
their platform. Without that, there will be confusion.

Of course, now that we are recommending GUC, all the flags become
useless. Kind of a circular arguement here. :-)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#8)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

OK, but when we recommend, we had better tell them to start using GUC
and not long command-line options _unless_ long options are supported on
their platform. Without that, there will be confusion.

This is entirely irrelevant, because the postmaster and backend don't
have any long options (except GUC variables which work anyway).

regards, tom lane

#10Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#9)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

OK, but when we recommend, we had better tell them to start using GUC
and not long command-line options _unless_ long options are supported on
their platform. Without that, there will be confusion.

This is entirely irrelevant, because the postmaster and backend don't
have any long options (except GUC variables which work anyway).

Oh, I see. We don't use long options for postmaster/postgres, just the
-c option to set a GUC value. Got it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#11Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#5)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

So we just mention it is going away, but there are duplicates so they
can't start removing -o yet?

Well, we'd have to give a table of recommended translations, eg

-o '-S n' => --sort-mem=n

This is the part that threw me off. I see in the postmaster docs under
-c:
On some systems it is also possible to equivalently
use GNU-style long options in the form
--name=value.

so we would have to recommend '-c sort-mem=n.'

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#12Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#11)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

This is the part that threw me off. I see in the postmaster docs under
-c:
On some systems it is also possible to equivalently
use GNU-style long options in the form
--name=value.

so we would have to recommend '-c sort-mem=n.'

--sort-mem works, period. Read the code.

That part of the docs is in error, evidently.

regards, tom lane

#13Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#12)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

This is the part that threw me off. I see in the postmaster docs under
-c:
On some systems it is also possible to equivalently
use GNU-style long options in the form
--name=value.

so we would have to recommend '-c sort-mem=n.'

--sort-mem works, period. Read the code.

That part of the docs is in error, evidently.

Docs updated.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#14Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#1)
Re: Call for objections: deprecate postmaster -o switch?

Tom Lane writes:

We had a discussion in late September about deprecating the postmaster's
-o switch in the 7.2 documentation, with an eye to removing it in 7.3:

I'm not sure this notice would be utterly helpful since we have no
concrete plans for any of the other options that need to be merged. The
best we can say right now is that "all 'postgres' options might change or
disappear soon".

--
Peter Eisentraut peter_e@gmx.net

#15Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#13)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian writes:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

This is the part that threw me off. I see in the postmaster docs under
-c:
On some systems it is also possible to equivalently
use GNU-style long options in the form
--name=value.

so we would have to recommend '-c sort-mem=n.'

--sort-mem works, period. Read the code.

That part of the docs is in error, evidently.

Docs updated.

Please change it back.

--
Peter Eisentraut peter_e@gmx.net

#16Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#12)
Re: Call for objections: deprecate postmaster -o switch?

Tom Lane writes:

--sort-mem works, period. Read the code.

That part of the docs is in error, evidently.

No it's not, unfortunately. BSD versions of getopt, including the one we
ship as replacement, have a bug that considers any argument that starts
with '--' to be equivalent with '--' (which means end of options).

--
Peter Eisentraut peter_e@gmx.net

#17Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#16)
Re: Call for objections: deprecate postmaster -o switch?

Peter Eisentraut <peter_e@gmx.net> writes:

No it's not, unfortunately. BSD versions of getopt, including the one we
ship as replacement, have a bug that considers any argument that starts
with '--' to be equivalent with '--' (which means end of options).

Ugh. Nonetheless, that doesn't equate to "you need GNU getopt to use
this". Can we be more specific about whether it works or not?

regards, tom lane

#18Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#14)
Re: Call for objections: deprecate postmaster -o switch?

Peter Eisentraut <peter_e@gmx.net> writes:

Tom Lane writes:

We had a discussion in late September about deprecating the postmaster's
-o switch in the 7.2 documentation, with an eye to removing it in 7.3:

I'm not sure this notice would be utterly helpful since we have no
concrete plans for any of the other options that need to be merged.

I was just planning to recommend not using -o, in favor of the already-
existing alternatives (-o -F => -F, -o -S n => --sort-mem=n, etc).

regards, tom lane

#19Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#17)
Re: Call for objections: deprecate postmaster -o switch?

Peter Eisentraut <peter_e@gmx.net> writes:

No it's not, unfortunately. BSD versions of getopt, including the one we
ship as replacement, have a bug that considers any argument that starts
with '--' to be equivalent with '--' (which means end of options).

Ugh. Nonetheless, that doesn't equate to "you need GNU getopt to use
this". Can we be more specific about whether it works or not?

OK, I just checked BSD/OS, and see in the docs:

The getopt() function returns -1 when the argument list is exhausted, or
a non-recognized option is encountered. The interpretation of options
in the argument list may be cancelled by the option `--' (double dash)
which causes getopt() to signal the end of argument processing and
returns -1. When all options have been processed (i.e., up to the first
non-option argument), getopt() returns -1.

However, I also see:

Option arguments are allowed to begin with ``-''; this is reasonable but
reduces the amount of error checking possible.

I see in postmaster.c:

while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:")) !=
^
And I started the postmaster using:

./bin/postmaster -B 2000 -i $DEBUG --sort-mem=60

so while the documentation says "--" ends arguments, it appears if you
specify "-" to getopt, it will honor it and not end the argument list.

Because this is identical on BSD/OS and FreeBSD, I assume all the BSD's
are the same. Peter, was there a specific failure of "--" options that
you remember?

I will be glad to put the docs back to warning about "--" options if is
indeed true, or perhaps we can be more specific.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#20Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#19)
Re: Call for objections: deprecate postmaster -o switch?

Bruce Momjian <pgman@candle.pha.pa.us> writes:

And I started the postmaster using:
./bin/postmaster -B 2000 -i $DEBUG --sort-mem=60

But

(a) did the sort_mem setting "take"?

(b) can you put more than one variable setting in there and have
them all take?

I tried

postmaster ... --enable_hashjoin=false --enable-mergejoin=false

and then verified

regression=# show enable_hashjoin;
NOTICE: enable_hashjoin is off
SHOW VARIABLE
regression=# show enable_mergejoin;
NOTICE: enable_mergejoin is off
SHOW VARIABLE

so it works okay on HPUX.

regards, tom lane

#21Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#19)
#22Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#20)
#23Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#22)
#24Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#23)
#25Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#23)
#26Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#25)
#27Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#17)
#28Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#26)
#29Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#28)
#30Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#29)