Thread: Long options for psql in 7.1.3

Long options for psql in 7.1.3

From
Arcady Genkin
Date:
Here's a lovely message I got from `psql':

  g9genarc@eddie:~$ psql -h /var/pgsql --help
  psql was compiled without support for long options.
  Use --help for help on invocation options.

I guess that it was confused by having both options at once, since
"psql --help" works fine (i.e. the long options *do* work).

Thanks,
--
Arcady Genkin

Re: Long options for psql in 7.1.3

From
greg@turnstep.com
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Here's a lovely message I got from `psql':
>
>   g9genarc@eddie:~$ psql -h /var/pgsql --help
>   psql was compiled without support for long options.
>   Use --help for help on invocation options.

Looks as though --help and --verbose always work, no
matter what the setting of HAVE_GETOPT_LONG.
Is this desired behavior? Seems fairly minor to me,
but it's confused at least one user. :)

(~ line 110 of src/bin/psql/startup.c)

Greg Sabino Mullane
greg@turnstep.com
PGP Key: 0x14964AC8 200110051402

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBO7ykZbybkGcUlkrIEQLoWgCfRrAic8XuPtLUhVK01p
bjWZrA/tkAniaB
0RQqHC+el2wFO1I/Bi70WTVh
=49Hm
-----END PGP SIGNATURE-----

Re: Long options for psql in 7.1.3

From
Bruce Momjian
Date:
-- Start of PGP signed section.
> > Here's a lovely message I got from `psql':
> >
> >   g9genarc@eddie:~$ psql -h /var/pgsql --help
> >   psql was compiled without support for long options.
> >   Use --help for help on invocation options.
>
> Looks as though --help and --verbose always work, no
> matter what the setting of HAVE_GETOPT_LONG.
> Is this desired behavior? Seems fairly minor to me,
> but it's confused at least one user. :)
>
> (~ line 110 of src/bin/psql/startup.c)

Intended. I think we hard-coded --help and --version for compatibility.
You will notice it doesn't _display_ the long options in the --help
display unless HAVE_GETOPT_LONG is defined.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Long options for psql in 7.1.3

From
Peter Eisentraut
Date:
Arcady Genkin writes:

>   g9genarc@eddie:~$ psql -h /var/pgsql --help
>   psql was compiled without support for long options.
>   Use --help for help on invocation options.
>
> I guess that it was confused by having both options at once, since
> "psql --help" works fine (i.e. the long options *do* work).

While this message is confusing, it's factually correct. ;-)

We used to have -? as the universal help option, but that

a) doesn't work in csh

b) doesn't play well with getopt(3)

So --help was the next best (or even better IMHO) choice, and to support
it on all installations we had to give it some special treatment.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: Long options for psql in 7.1.3

From
Arcady Genkin
Date:
Peter Eisentraut <peter_e@gmx.net> writes:

> >   g9genarc@eddie:~$ psql -h /var/pgsql --help
> >   psql was compiled without support for long options.
> >   Use --help for help on invocation options.
> >
> > I guess that it was confused by having both options at once, since
> > "psql --help" works fine (i.e. the long options *do* work).
>
> While this message is confusing, it's factually correct. ;-)
Yes, confusing it is.

[...]
> So --help was the next best (or even better IMHO) choice, and to support
> it on all installations we had to give it some special treatment.

That's fine, but IMO "psql -h /var/pgsql --help" and "psql --help"
should either both work, or both not work.  Of course, this is not a
huge issue, but it did make me rub my eyes (to make sure I wasn't
seeing a ghost) the first time I've encountered it. :)

Thanks,
--
Arcady Genkin

Re: Long options for psql in 7.1.3

From
Peter Eisentraut
Date:
Arcady Genkin writes:

> That's fine, but IMO "psql -h /var/pgsql --help" and "psql --help"
> should either both work, or both not work.

I don't think so.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: Long options for psql in 7.1.3

From
John Summerfield
Date:
On 4 Oct 2001, Arcady Genkin wrote:


> Peter Eisentraut <peter_e@gmx.net> writes:
>
> > >   g9genarc@eddie:~$ psql -h /var/pgsql --help
> > >   psql was compiled without support for long options.
> > >   Use --help for help on invocation options.
> > >
> > > I guess that it was confused by having both options at once, since
> > > "psql --help" works fine (i.e. the long options *do* work).
> >
> > While this message is confusing, it's factually correct. ;-)
> Yes, confusing it is.
>
> [...]
> > So --help was the next best (or even better IMHO) choice, and to support
> > it on all installations we had to give it some special treatment.
>
> That's fine, but IMO "psql -h /var/pgsql --help" and "psql --help"
> should either both work, or both not work.  Of course, this is not a
> huge issue, but it did make me rub my eyes (to make sure I wasn't
> seeing a ghost) the first time I've encountered it. :)
>

On a related matter, psql --help doesn't display the long forms even though they're evidently enabled:

[pgtest@numbat pgtest]$ psql --help
This is psql, the PostgreSQL interactive terminal.

Usage:
  psql [options] [dbname [username]]

Options:
  -a              Echo all input from script
  -A              Unaligned table output mode (-P format=unaligned)
  -c COMMAND      Run only single command (SQL or internal) and exit
  -d DBNAME       Specify database name to connect to (default: pgtest)
  -e              Echo commands sent to server
  -E              Display queries that internal commands generate
  -f FILENAME     Execute commands from file, then exit
  -F STRING       Set field separator (default: "|") (-P fieldsep=)
  -h HOSTNAME     Specify database server host (default: local socket)
  -H              HTML table output mode (-P format=html)
  -l              List available databases, then exit
  -n              Disable enhanced command line editing (readline)
  -o FILENAME     Send query results to file (or |pipe)
  -p PORT         Specify database server port (default: 5433)
  -P VAR[=ARG]    Set printing option 'VAR' to 'ARG' (see \pset command)
  -q              Run quietly (no messages, only query output)
  -R STRING       Set record separator (default: newline) (-P recordsep=)
  -s              Single step mode (confirm each query)
  -S              Single line mode (end of line terminates SQL command)
  -t              Print rows only (-P tuples_only)
  -T TEXT         Set HTML table tag attributes (width, border) (-P tableattr=)
  -U NAME         Specify database user name (default: pgtest)
  -v NAME=VALUE   Set psql variable 'NAME' to 'VALUE'
  -V              Show version information and exit
  -W              Prompt for password (should happen automatically)
  -x              Turn on expanded table output (-P expanded)
  -X              Do not read startup file (~/.psqlrc)

For more information, type "\?" (for internal commands) or "\help"
(for SQL commands) from within psql, or consult the psql section in
the PostgreSQL documentation.

Report bugs to <pgsql-bugs@postgresql.org>.
[pgtest@numbat pgtest]$ psql --host
psql: option `--host' requires an argument
Try 'psql --help' for more information.
[pgtest@numbat pgtest]$ psql --version
psql (PostgreSQL) 7.2devel
contains support for: readline, history
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Portions Copyright (c) 1996, Regents of the University of California
Read the file COPYRIGHT or use the command \copyright to see the
usage and distribution terms.
[pgtest@numbat pgtest]$