Re: psql and output from \?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ian Barwick <barwick(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql and output from \?
Date: 2002-03-11 18:21:29
Message-ID: 200203111821.g2BILUX27268@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I haven't seen a followup patch so I decided to work on it myself;
patch attached and applied to CVS. Thanks.

---------------------------------------------------------------------------

Ian Barwick wrote:
>
> First off:
> This is a suggestion for minor changes to the output generated by the \?
> command in psql. While it is more of a documentation issue, it would
> involve changing code (well, a few strings) - is this the right place for
> raising the subject? I would be happy to submit a patch if the changes are
> acceptable.
>
> Background:
> In psql the \? command shows a summary of the available "slash" commands.
> The syntax shown is however not always consistent (neither with the \?
> command output nor with the psql manpage); eg.:
>
> "\cd [DIRNAME] change the current working directory"
>
> implies that provision of a parameter is optional (correct), whereas
>
> "\C TITLE set table title"
>
> implies that a title parameter is required. This is not in fact the case,
> as executing \C without a parameter will unset any title previously set
> with the same command. This behaviour is however correctly
> documented in the manpage, which also shows the
> command syntax as "\C [ title ]".
>
> Similar is true of the following slash commands: \d \e \f \g \s \T
>
> Solution:
> Appended is a list of relevant backslash commands, their current
> description as produced by \?, the respective manpage description (or
> first part thereof) and suggested replacment for the \? description.
> Assumption is that square brackets - as used elsewhere within the
> \? output and the manpage documentation - imply optional parameters.
>
>
> Yours pedantically
>
> Ian Barwick
>
> Suggestions follow:
>
> \C
> -----------------------------------------------------------------------
>
> psql \?:
> \C TITLE set table title
>
> man:
> \C [ title ]
> Set the title of any tables being printed as the
> result of a query or unset any such title. (...)
>
> psql \? new:
> \C [ TITLE ] set table title (or unset with no arguments)
>
>
> \d
> -----------------------------------------------------------------------
>
> psql \?:
> \d TABLE describe table (or view, index, sequence)
>
> man:
> \d relation
> Shows all columns of relation (which could be a
> table, view, index, or sequence), (...)
>
> psql \? new:
> \d [ RELATION ] describe relation (table, view, index or sequence)
>
>
> \e
> -----------------------------------------------------------------------
>
> psql \?:
> \e FILENAME edit the current query buffer or file with external editor
>
> man
> \edit (or \e) [ filename ]
> If filename is specified, the file is edited; (...)
>
> psql \? new:
> \e [ FILENAME ] edit the current query buffer or file with external editor
>
>
> \f
> -----------------------------------------------------------------------
>
> psql \?:
> \f STRING set field separator
>
> man:
> \f [ string ]
> Sets the field separator for unaligned query output. (...)
>
> psql \? new:
> \f [ STRING ] show or set field separator
>
>
> \g
> -----------------------------------------------------------------------
>
> psql \?:
> \g FILENAME send SQL command to server (and write results to file or |pipe)
>
> man:
> \g [ { filename | |command } ]
> Sends the current query input buffer to the backend
> and optionally saves the output in filename or
> pipes the output into a separate Unix shell to exe?
> cute command. (...)
>
> psql \? new:
> \g [ FILE | |PIPE ] send SQL command to server (and write results to file or
> |pipe)
>
>
> \s
> -----------------------------------------------------------------------
>
> psql \?:
> \s FILENAME print history or save it to file
>
> man:
> \s [ filename ]
> Print or save the command line history to filename.
>
> psql \? new:
> \s [ FILENAME ] print command line history or save it to file
>
>
> \T
> -----------------------------------------------------------------------
>
> psql \?:
> \T TEXT set HTML table tag attributes
>
> man:
> \T table_options
> Allows you to specify options to be placed within
> the table tag in HTML tabular output mode. (...)
>
> psql \? new:
> \T [ TAG_ATTR ] set HTML <table> tag attributes (or unset with no arguments)
>
>
> __END__
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

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

Attachment Content-Type Size
unknown_filename text/plain 7.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-03-11 18:26:53 Re: psql and output from \?
Previous Message Bruce Momjian 2002-03-11 18:10:15 Re: Allowing usernames in pg_hba.conf