Skip to content

Settings and variables

The settings and variables of usql v0.19.13-0.20261129074835-be3acfadfc0c, as \? variables lists them. Each belongs to a section. The section is a key of config.yaml, and\config and -O name a setting with its section, asprint.border.

Keys of config.yaml

config.yaml holds each section as a map of names and values. TheConfigure usql guide says where the file is.

KeyWhat it holds
vars:usql script variables
usql:Settings of usql
print:Display settings
charts:Chart settings
env:Environment of the commands that usql runs, such as \!, the pager and the editor
connections:Named connections
aliases:Aliases, the meta commands of the user

usql script variables

The section vars. Set a name of it with:

usql --set=NAME=VALUE
\set NAME VALUE inside usql

A script variable can have any name. usql sets the variables of this table itself.

NameDescription
ROW_COUNT
vars.ROW_COUNT
number of rows returned or affected by the last query, or 0 if it failed

Settings of usql

The section usql. Set a name of it with:

usql --uset=NAME=VALUE
\uset NAME VALUE inside usql
NameDescription
echo_hidden
usql.echo_hidden
if set, display internal queries executed by backslash commands; if set to "noexec", shows queries without execution
editor
usql.editor
editor used by the \e, \ef, and \ev commands
fetch_count
usql.fetch_count
the number of result rows to read and show at a time, 0 for all of them at once, as psql's FETCH_COUNT (default 0)
on_error_stop
usql.on_error_stop
stop batch execution after error
pager
usql.pager
name of external pager program
prompt1
usql.prompt1
specifies the standard usql prompt
prompt2
usql.prompt2
specifies the prompt used when a statement continues on another row
quiet
usql.quiet
run quietly (same as -q option)
show_host_information
usql.show_host_information
display host information when connecting to a database
encoding
usql.encoding
encoding of a script read with -f, \i or from a pipe, such as windows-1252 or shift_jis (default utf-8)
sslmode
usql.sslmode
when set to 'retry', allows connections to attempt to reconnect when no ?sslmode= was specified on the url
syntax_hl
usql.syntax_hl
enable syntax highlighting of the input
syntax_hl_format
usql.syntax_hl_format
color depth of the highlighting [noop, terminal, terminal256, terminal16m]
syntax_hl_override_bg
usql.syntax_hl_override_bg
keep the background of the terminal, and not the background of the highlighting style
syntax_hl_style
usql.syntax_hl_style
syntax highlighting style name
term_graphics
usql.term_graphics
use the specified terminal graphics

Display settings

The section print. Set a name of it with:

usql --pset=NAME[=VALUE]
\pset NAME [VALUE] inside usql
NameDescription

Chart settings

The section charts. Set a name of it with:

usql --option=charts.NAME=VALUE
\config charts.NAME VALUE inside usql
NameDescription
path
charts.path
directory of the chart files, relative to the directory of the configuration file (default "charts")

Environment of the commands that usql runs, such as \!, the pager and the editor

The section env. Set a name of it with:

usql --option=env.NAME=VALUE
\setenv NAME [VALUE] inside usql

The names of this section are the ones that you pick.

Named connections

The section connections. Set a name of it with:

usql --cset=NAME=DSN
\cset NAME [DSN] inside usql
\cset NAME DRIVER PARAMS... inside usql

The names of this section are the ones that you pick.

Aliases, the meta commands of the user

The section aliases. Set a name of it with:

NAME: TEXT under aliases: in config.yaml, which \NAME runs

The names of this section are the ones that you pick.