If a long option that accepts an optional argument is given without one, optind is advanced twice, and the following argument is skipped. For example, "pg_waldump --stats --limit 5" skips --limit and interprets "5" as a non-option, so the command complains that it cannot location WAL file "5". The same path also returns BADARG when optstring starts with a colon, even though nothing is missing. To fix, handle optional arguments before the missing-argument code, which then only needs to deal with required arguments. This is a bug fix and could be back-patched, but since this issue went unnoticed for 23 years, I'm not going to bother. Author: Sehrope Sarkuni <sehrope@jackdb.com> Reviewed-by: solai v <solai.cdac@gmail.com> Discussion: https://postgr.es/m/CAH7T-arxDuVCSkorO%3Dk7%2BM-_JV0JFzMpN_EtKMyD2K0RDqZ2OA%40mail.gmail.com
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.