Re: proposal: new long psql parameter --on-error-stop - Mailing list pgsql-hackers

From Fabrízio de Royes Mello
Subject Re: proposal: new long psql parameter --on-error-stop
Date
Msg-id CAFcNs+pBM6LTKAL1JMp9VD2kxGbs+r420jD-H02PqP3YoLFVrg@mail.gmail.com
Whole thread Raw
In response to Re: proposal: new long psql parameter --on-error-stop  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: new long psql parameter --on-error-stop
List pgsql-hackers

On Sat, Mar 1, 2014 at 5:37 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
> Hello
>
> here is a prototype:
>
> bash-4.1$ /usr/local/pgsql/bin/psql --help-variables
> List of some variables (options) for use from command line.
> Complete list you find in psql section in the PostgreSQL documentation.
>
> psql variables:
> Usage:
>   psql --set=NAME=VALUE
>   or \set NAME VALUE in interactive mode
>
>   AUTOCOMMIT         when is on, successful SQL command is automatically commited
>   COMP_KEYWORD_CASE  determines which letter case to use when completing an SQL key word
>   ECHO               all lines from input can be written to standard output
>   ECHO_HIDDEN        display queries for internal commands (same as -E option)
>   FETCH_COUNT        how many rows should be for one page (default 0 unlimited)
>   HISTFILE           file name that be used for store history list
>   HISTSIZE           the number of commands to store in the command history
>   ON_ERROR_ROLLBACK  when is on, raise ROLLBACK on error automatically
>   ON_ERROR_STOP      when is set, then batch execution stop immediately after error
>   VERBOSITY          control verbosity of error reports [default, verbose, terse]
>
> Printing options:
> Usage:
>   psql --pset=NAME[=VALUE]
>   or \pset NAME [VALUE] in interactive mode
>
>   border             number of border style
>   fieldsep           specify field separator for unaligned output
>   fieldsep_zero      field separator in unaligned mode will be zero
>   format             set output format [unaligned, aligned, wrapped, html, latex, ..]
>   linestyle          sets the border line drawing style [ascii, old-ascii, unicode]
>   null               sets the string to be printed in place of a null value
>   pager              when the pager option is off, the pager program is not used
>   recordsep          specifies the record (line) separator to use in unaligned output format
>   recordsep_zero     record separator be in unaligned output format a zero byte
>   title              sets the table title for any subsequently printed tables
>   tuples_only        in tuples-only mode, only actual table data is shown
>
> Environment options:
> Usage:
>   NAME=VALUE, [NAME=VALUE] psql ...
>   or \setenv NAME [VALUE] in interactive mode
>
>   COLUMNS            number of columns for wrapped format
>   PAGER              used pager
>   PGHOST             same as the host connection parameter
>   PGDATABASE         same as the dbname connection parameter
>   PGUSER             same as the user connection parameter
>   PGPASSWORD         possibility to set password
>   PSQL_EDITOR, EDITOR, VISUAL  editor used by \e \ef commands
>   PSQL_EDITOR_LINE_NUMBER_ARG  style how to line number is used in editor
>   PSQL_HISTORY       alternative location for the command history file
>   PSQL_RC            alternative location of the user's .psqlrc file
>   SHELL              command executed by the \! command
>   TMPDIR             directory for storing temporary files
>
> For more information consult the psql section in the PostgreSQL
> documentation.
>

The patch is ok (apply to master and apply to master without errors).

Maybe we must show the possible values for each variable/option too.

Thinking more about it, would be nice if we have the possibility to show help for commands too. Some like that:

$ psql -H vacuum
Command:     VACUUM
Description: garbage-collect and optionally analyze a database
Syntax:
VACUUM [ ( { FULL | FREEZE | VERBOSE | ANALYZE } [, ...] ) ] [ table_name [ (column_name [, ...] ) ] ]
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ table_name ]
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ table_name [ (column_name [, ...] ) ] ]

$ psql --help-command=vacuum
Command:     VACUUM
Description: garbage-collect and optionally analyze a database
Syntax:
VACUUM [ ( { FULL | FREEZE | VERBOSE | ANALYZE } [, ...] ) ] [ table_name [ (column_name [, ...] ) ] ]
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ table_name ]
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ table_name [ (column_name [, ...] ) ] ]

It's only an idea that occurred to me reading this thread!

Grettings,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Securing "make check" (CVE-2014-0067)
Next
From: Andrew Dunstan
Date:
Subject: Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode