Slash command

A psql meta-command (also known as "backslash command")

A slash command is a psql meta-command (also known as "backslash command"), beginning - as the name implies - with a backslash ("\").

Slash commands perform a variety of functions, including executing queries and specifying the result output format, setting psql options and even forming the basis for a simple scripting language.

A summary of available slash commands in psql can be retrieved by entering \?.

Examples

postgres=# SELECT 1\g
 ?column? 
----------
        1
(1 row)

For useful tips on working with slash commands, see the following psql hacks:

Categories

psql

See also

psql