Re: pg_ctl only allows 12 parameters?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_ctl only allows 12 parameters?
Date: 2023-12-18 16:09:23
Message-ID: 3960907.1702915763@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> On Mon, Dec 18, 2023 at 10:41 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> 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?

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Johnson 2023-12-18 16:31:55 Re: pg_ctl only allows 12 parameters?
Previous Message David G. Johnston 2023-12-18 16:02:03 Re: pg_ctl only allows 12 parameters?