On Mon, Dec 18, 2023 at 11:09 AM Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
Ron Johnson <ronljohnsonjr@xxxxxxxxx> writes:
> On Mon, Dec 18, 2023 at 10:41 AM David G. Johnston <
> david.g.johnston@xxxxxxxxx> wrote:
>> I'm thinking that the forced ordering being different than what is
>> documented is a shell-specific issue. As for why only one of restart,
>> stop, start, etc... can be specified for any given invocation of pg_ctl,
>> that seems like an entirely realistic limitation and typo-preventing
>> feature.
> The error message is "pg_ctl: *too many command-line arguments*". It's
> manifestly obvious that the command failed when I added a "-" option, not a
> "start", "stop" command. and yet pg_ctl complained about command-line
> arguments.
The program's coding expects that optional switches will appear before
the action specifier. You can get away with writing the action first
only if the version of getopt_long() that's in use will permute the
argument array to move non-options to the end. That's always true on
glibc-based platforms, but otherwise usually not, at least in PG v14.
(Yes, I'm aware that pg_ctl's --help message claims this works
everywhere. It's lying.)
Having said that, the most obvious way to explain the results you
seem to be getting is that you're using a version of getopt_long()
that tries to permute the arguments and is getting it wrong.
So, what's the platform? And are you quite sure your psql is v14?
$ psql -V
psql (PostgreSQL) 14.10
$ postgres -V
postgres (PostgreSQL) 14.10
$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.9 (Ootpa)
# This is a "SLES Expanded Support platform 8.9"
# The above "Red Hat Enterprise Linux Server" string is only used to
# keep software compatibility.
$ yum list installed 'postgresql*'
Installed Packages
postgresql14.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-contrib.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-docs.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-libs.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-plperl.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-plpython3.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-server.x86_64 14.10-1PGDG.rhel8 @@commandline
psql (PostgreSQL) 14.10
$ postgres -V
postgres (PostgreSQL) 14.10
$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.9 (Ootpa)
# This is a "SLES Expanded Support platform 8.9"
# The above "Red Hat Enterprise Linux Server" string is only used to
# keep software compatibility.
$ yum list installed 'postgresql*'
Installed Packages
postgresql14.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-contrib.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-docs.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-libs.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-plperl.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-plpython3.x86_64 14.10-1PGDG.rhel8 @@commandline
postgresql14-server.x86_64 14.10-1PGDG.rhel8 @@commandline