Re: make pg_controldata accept "-D dirname"

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: make pg_controldata accept "-D dirname"
Date: 2014-09-24 13:58:49
Message-ID: 20140924135849.GO5311@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2014-09-24 13:59:39 Re: "Core" function in Postgres
Previous Message Oskari Saarenmaa 2014-09-24 13:56:39 Re: missing isinf declaration on solaris