\?
-------------------------------------
General
\copyright display the use and release license terms for PostgreSQL
\g [file] or; Execute the query (and write the results to a file or | pipeline)
\gset [PREFIX] executes the query and saves the result to the PSQL variable
\h [name] SQL command syntax description, with * Show all commands syntax description
\q Exit Psql
\watch [SEC] Executes a query every SEC second
Query buffers
\e [file] [line] using an external editor to edit the query buffer (or file)
\EF [ FUNCNAME [line]] using an external editor to edit function definitions
\p Display the contents of the query buffer
\r Reset (Clear) query buffers
\w File writes the contents of the query buffer to a file
Input/Output
\copy ... Execute SQL COPY to send the data stream to the client host
\echo [string] writes a string to standard output
\i files to execute commands from a file
\ir FILE is similar to \i, but relative to the location of the current script
\o [file] writes all query results to a file or | pipeline
\qecho [string] writes a string to the query output stream (reference \o)
Informational
(option: S = Display System object, + = rest details)
\d[s+] Lists tables, views, and sequences
\d[s+] Name Description table, view, sequence, or index
\da[s] [mode] lists aggregate functions
\db[+] [mode] List table space
\dc[s+] [PATTERN] list conversion
\dc[+] [PATTERN] lists type casts
\dd[s] [PATTERN] shows an object description that is not displayed elsewhere
\DDP [mode] List default permissions
\dd[s+] [PATTERN] lists common domains
\det[+] [PATTERN] Lists reference tables
\des[+] [mode] lists external servers
\deu[+] [mode] list user mappings
\dew[+] [mode] lists external data wrappers
\df[antw][s+] [mode] list [include aggregate/general/trigger/window] function
\df[+] [mode] List text search configuration
\dfd[+] [mode] Lists text search dictionaries
\dfp[+] [mode] List text Search parser
\dft[+] [mode] List text Search template
\dg[+] [PATTERN] Lists roles
\di[s+] [mode] List index
\DL lists large objects with the same functionality as \lo_list
\dl[s+] [PATTERN] Lists all process languages
\dm[s+] [PATTERN] Lists all materialized views
\dn[s+] [pattern] Lists all modes
\do[s] [schema] list operators
\do[s+] [PATTERN] Lists all proofing rules
\DP [mode] lists access permissions for tables, views, and sequences
\drds [Mode 1 [Mode 2]] lists the role settings for each database
\ds[s+] [mode] list sequence
\dt[s+] [mode] List table
\dt[s+] [mode] list data types
\du[+] [PATTERN] Lists roles
\dv[s+] [mode] List view
\de[s+] [PATTERN] Lists reference tables
\dx[+] [PATTERN] lists extensions
\dy [PATTERN] Lists all event triggers
\l[+] [PATTERN] Lists all databases
\sf[+] FUNCNAME display function definition
\z [mode] and \DP function the same
Formatting
\a switching between non-aligned and Aligned modes
\c [string] Sets the title of the table, or if no caption is canceled
\f [string] Displays or sets the field delimiter for non-aligned mode query output
\h Toggle HTML Output mode (currently off)
\pset NAME [VALUE] setting table Output Options
(NAME: = {format|border|expanded|fieldsep|fieldsep_zero|footer|null|numericlocale|recordsep|recordsep_zero| Tuples_only|title|tableattr|pager})
\ t [on | off] displays only records (currently closed)
\ t [string] set HTML < table > tag properties, or Cancel if not set
\x [On|off|auto] Toggle Extended output mode (currently off)
Connection
\c[onnect] [Database name |-User name |-Host |-Port |]
Connect to a new database (currently "Postgres")
\encoding [encoded name] Displays or sets the client code
\password [USERNAME] Safely change the password for the user
\conninfo displaying information about the current connection
Operating system
\CD [Catalogue] Change the current working directory
\setenv NAME [VALUE] to set or empty environment variables
\timing [on | off] Toggle Command timing switch (currently off)
\! [command] Executes a command in the shell or launches an interactive shell
Variable
\prompt [text] name prompts the user to set internal variables
\set [name [value]] SET internal variable, if no argument lists all variables
\unset name Empty (delete) internal variable
Large Object
\lo_export loboid File
\lo_import file [Note]
\lo_list
\lo_unlink loboid Large Object operation