ABORT ALTERTRIGGERCREATE RULE DROPGROUP LISTEN
ALTER AGGREGATE ALTER TYPE CREATESCHEMADROP INDEX LOADALTERCOLLATIONALTERUSERCREATE SEQUENCE DROPLANGUAGELOCKALTER CONVERSION ALTERUSER MAPPING CREATE SERVER DROP MATERIALIZED VIEW MOVE
ALTERDATABASEALTERVIEWCREATE STATISTICS DROP OPERATOR NOTIFY
ALTERDEFAULTPRIVILEGES ANALYZE CREATE SUBSCRIPTION DROP OPERATOR CLASS PREPAREALTERDOMAINBEGINCREATETABLEDROP OPERATOR FAMILY PREPARETRANSACTIONALTER EVENT TRIGGER CHECKPOINT CREATETABLEASDROP OWNED REASSIGN OWNED
ALTER EXTENSION CLOSECREATE TABLESPACE DROP POLICY REFRESH MATERIALIZED VIEWALTERFOREIGN DATA WRAPPER CLUSTER CREATE TEXT SEARCH CONFIGURATION DROP PUBLICATION REINDEX
ALTERFOREIGNTABLE COMMENT CREATE TEXT SEARCH DICTIONARY DROP ROLE RELEASE SAVEPOINT
ALTER FUNCTION COMMITCREATE TEXT SEARCH PARSER DROP RULE RESET
ALTERGROUPCOMMIT PREPARED CREATE TEXT SEARCH TEMPLATE DROPSCHEMAREVOKEALTER INDEX COPY CREATE TRANSFORM DROP SEQUENCE ROLLBACKALTERLANGUAGECREATE ACCESS METHOD CREATETRIGGERDROP SERVER ROLLBACK PREPARED
ALTER LARGE OBJECT CREATE AGGREGATE CREATE TYPE DROP STATISTICS ROLLBACKTO SAVEPOINT
ALTER MATERIALIZED VIEWCREATECASTCREATEUSERDROP SUBSCRIPTION SAVEPOINT
ALTER OPERATOR CREATECOLLATIONCREATEUSER MAPPING DROPTABLE SECURITY LABEL
ALTER OPERATOR CLASS CREATE CONVERSION CREATEVIEWDROP TABLESPACE SELECTALTER OPERATOR FAMILY CREATEDATABASEDEALLOCATEDROP TEXT SEARCH CONFIGURATION SELECTINTOALTER POLICY CREATEDOMAINDECLAREDROP TEXT SEARCH DICTIONARY SETALTER PUBLICATION CREATE EVENT TRIGGERDELETEDROP TEXT SEARCH PARSER SETCONSTRAINTSALTER ROLE CREATE EXTENSION DISCARD DROP TEXT SEARCH TEMPLATE SET ROLE
ALTER RULE CREATEFOREIGN DATA WRAPPER DODROP TRANSFORM SETSESSIONAUTHORIZATIONALTERSCHEMACREATEFOREIGNTABLEDROP ACCESS METHOD DROPTRIGGERSETTRANSACTIONALTER SEQUENCE CREATE FUNCTION DROP AGGREGATE DROP TYPE SHOWALTER SERVER CREATEGROUPDROPCASTDROPUSERSTARTTRANSACTIONALTER STATISTICS CREATE INDEX DROPCOLLATIONDROPUSER MAPPING TABLEALTER SUBSCRIPTION CREATELANGUAGEDROP CONVERSION DROPVIEWTRUNCATEALTER SYSTEM CREATE MATERIALIZED VIEWDROPDATABASEEND UNLISTEN
ALTERTABLECREATE OPERATOR DROPDOMAINEXECUTEUPDATEALTER TABLESPACE CREATE OPERATOR CLASS DROP EVENT TRIGGER EXPLAIN VACUUM
ALTER TEXT SEARCH CONFIGURATION CREATE OPERATOR FAMILY DROP EXTENSION FETCHVALUESALTER TEXT SEARCH DICTIONARY CREATE POLICY DROPFOREIGN DATA WRAPPER GRANTWITHALTER TEXT SEARCH PARSER CREATE PUBLICATION DROPFOREIGNTABLE IMPORT FOREIGNSCHEMAALTER TEXT SEARCH TEMPLATE CREATE ROLE DROP FUNCTION INSERT
psql commands
General
\copyright show PostgreSQL usage and distribution terms
\crosstabview [COLUMNS] execute query and display results in crosstab
\errverbose show most recent error message at maximum verbosity
\g [FILE] or ; execute query (and send results tofileor |pipe)
\gexec execute query, then execute each value initsresult
\gset [PREFIX] execute query and store results in psql variables
\gx [FILE] as \g, but forces expanded output mode
\q quit psql
\watch [SEC] execute query every SEC seconds
Help
\? [commands] show help on backslash commands
\? options show help on psql command-line options
\? variables show help on special variables
\h [NAME] help on syntax of SQL commands, * for all commands
Query Buffer
\e [FILE] [LINE] edit the query buffer (orfile) with external editor
\ef [FUNCNAME [LINE]] edit function definition with external editor
\ev [VIEWNAME [LINE]] edit view definition with external editor
\p show thecontentsofthe query buffer
\r reset (clear) the query buffer
\s [FILE] display history or save ittofile
\w FILE write query buffer tofile
Input/Output
\copy ... perform SQL COPY with data stream tothe client host
\echo [STRING] writestringto standard output
\i FILE execute commands fromfile
\ir FILE as \i, but relative to location of current script
\o [FILE] send all query results tofileor |pipe
\qecho [STRING] writestringto query output stream (see \o)
Conditional
\if EXPR begin conditional block
\elif EXPR alternative within current conditional block
\else final alternative within current conditional block
\endif end conditional block
Informational
(options: S = show system objects, + = additional detail)
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregates
\dA[+] [PATTERN] list access methods
\db[+] [PATTERN] list tablespaces
\dc[S+] [PATTERN] list conversions
\dC[+] [PATTERN] list casts
\dd[S] [PATTERN] show object descriptions not displayed elsewhere