Skip to content

ybsql Environment Variables

You can set the following environment variables in two ways:

  • When starting a session:
NAME=VALUE [NAME=VALUE] ybsql
  • Inside a session:
\setenv NAME [VALUE]
COLUMNS

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

PAGER

Name of an external pager command. If query results do not fit on the screen, they are piped through this command (for example, more or less). The default is platform-dependent. You can disable the pager by setting PAGER to empty or by using pager-related options of the \pset command.

SHELL

Shell used by the \! command.

TMPDIR

Directory for temporary files. The default is /tmp.

YBAPPNAME

Equivalent to the application_name connection parameter. The Yellowbrick tools set appropriate names for themselves, such as ybsql. The value of YBAPPNAME may be used as the name for a custom application that does not set its own default name.

YBDATABASE

Name of the destination database. Default: yellowbrick. See ybsql Connections.

YBHOST

Name of the destination server host. Default: localhost. See ybsql Connections.

YBPASSFILE

Name of a file where passwords are stored. The default file is in the user's home directory (.ybpass on Linux and ybpass.conf on Windows). The file should contain entries like this:

hostname:port:database:username:password
YBPASSWORD

Interactive prompt for the database user's password. No default. See ybsql Connections.

YBPORT

The destination server port number. Default: 5432. See ybsql Connections.

YBSSLMODE

Determines whether or not SSL/TLS is used when connecting to the server and, if so, how. See ybsql Connections.

YBSQL_EDITOR, EDITOR, VISUAL

Editor used by the \e command. Default editors are vi on Linux and notepad.exe on Windows.

YBSQL_EDITOR_LINENUMBER_ARG

The command-line argument that passes the starting line number to the editor when the \e command specifies a line number. The value of this variable must be a valid argument for the editor being used. For editors such as Emacs or vi, this value is a plus sign. Include a trailing space in the value of the variable if a space is required between the option name and the line number.

YBSQL_HISTORY

Alternative location for the command history file.

YBSQLRC

Alternative location for the user's .ybsqlrc file.

YBUSER

The database login username. No default. See ybsql Connections.

Examples

$ YBDATABASE=premdb YBUSER=bobr SHELL=bash ./ybsql
Password: 
Null display is "[NULL]".
Expanded display is used automatically.
ybsql (1.2.1.5007)
Type "help" for help.

premdb=>
premdb=> \setenv YBUSER bobr
premdb=> \! env
...
COLUMNS=136
YBUSER=bobr
SHELL=bash
PWD=/usr/bin
YBDATABASE=premdb
premdb=>
premdb=# \setenv YBSQL_EDITOR 'emacs'
\setenv YBSQL_EDITOR_LINENUMBER_ARG '+'
premdb=# \e /home/premdb/match.csv 8500
...

Parent topic:ybsql Reference