RefLib

Reference library for AI

Back

postgresql_16:7.2.18.5 Environment

PostgreSQL 16 > Reference > PostgreSQL Client Applications > psql > Environment

COLUMNS

If \pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.

PGDATABASE, PGHOST, PGPORT, PGUSER

Default connection parameters (see (see postgresql_16:5.1.15)).

PG_COLOR

Specifies whether to use color in diagnostic messages. Possible values are always, auto and never.

PSQL_EDITOR, EDITOR, VISUAL

Editor used by the \e, \ef, and \ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.

PSQL_EDITOR_LINENUMBER_ARG

When \e, \ef, or \ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi, this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line '

The default is + on Unix systems (corresponding to the default editor vi, and useful for many other common editors); but there is no default on Windows systems.

PSQL_HISTORY

Alternative location for the command history file. Tilde (~) expansion is performed.

PSQL_PAGER, PAGER

If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less. Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.

PSQL_WATCH_PAGER

When a query is executed repeatedly with the \watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \watch if started with the option --stream.

PSQLRC

Alternative location of the user's .psqlrc file. Tilde (~) expansion is performed.

SHELL

Command executed by the \! command.

TMPDIR

Directory for storing temporary files. The default is /tmp.

This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see (see postgresql_16:5.1.15)).

Back