Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFGBQ-0094Se-4i for pgsql-admin@arkaria.postgresql.org; Mon, 18 Dec 2023 16:09:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rFGBO-00AbQm-Mo for pgsql-admin@arkaria.postgresql.org; Mon, 18 Dec 2023 16:09:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFGBO-00AbQd-Be for pgsql-admin@lists.postgresql.org; Mon, 18 Dec 2023 16:09:30 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFGBL-00CeEC-8l for pgsql-admin@lists.postgresql.org; Mon, 18 Dec 2023 16:09:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BIG9Nj03960908; Mon, 18 Dec 2023 11:09:23 -0500 From: Tom Lane To: Ron Johnson cc: "David G. Johnston" , Pgsql-admin Subject: Re: pg_ctl only allows 12 parameters? In-reply-to: References: Comments: In-reply-to Ron Johnson message dated "Mon, 18 Dec 2023 10:48:21 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3960906.1702915763.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 18 Dec 2023 11:09:23 -0500 Message-ID: <3960907.1702915763@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron Johnson writes: > On Mon, Dec 18, 2023 at 10:41 AM David G. Johnston < > david.g.johnston@gmail.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