Abhijit Menon-Sen wrote:
> P.S. Trivia: I can't find any other options in Postgres where the
> argument is mandatory but the option is optional.
psql behaves similarly with its -d and -U switches also; note --help:
Usage: psql [OPTION]... [DBNAME [USERNAME]]
... -d, --dbname=DBNAME database name to connect to (default: "alvherre")
... -U, --username=USERNAME database user name (default: "alvherre")
Both are optional and have defaults. Datadir for pg_controldata is also
optional and --help contains this blurb:
If no data directory (DATADIR) is specified, the environment variable PGDATA
is used.
I think you could replace those lines with -D data directory blah (default: "value of $PGDATA")
But psql --help doesn't use $PGUSER to expand the default value for -U;
I'm not clear if this means we shouldn't expand PGDATA in the help line
for pg_controldata, or need to fix psql to expand PGUSER in -U.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services