使用下面的
\help
或 \h
,我可以列出 SQL 命令,如下所示:
\help
或者:
\h
postgres=# \help
Available help:
ABORT CREATE USER
ALTER AGGREGATE CREATE USER MAPPING
ALTER COLLATION CREATE VIEW
ALTER CONVERSION DEALLOCATE
ALTER DATABASE DECLARE
ALTER DEFAULT PRIVILEGES DELETE
ALTER DOMAIN DISCARD
ALTER EVENT TRIGGER DO
ALTER EXTENSION DROP ACCESS METHOD
ALTER FOREIGN DATA WRAPPER DROP AGGREGATE
ALTER FOREIGN TABLE DROP CAST
ALTER FUNCTION DROP COLLATION
ALTER GROUP DROP CONVERSION
ALTER INDEX DROP DATABASE
ALTER LANGUAGE DROP DOMAIN
...
现在,如何列出 PostgreSQL 中的反斜杠命令,如
\l
、\dt
、\q
、\h
等?
通过下面的
\?
,您可以列出PostgreSQL中的反斜杠命令,如下所示:
\?
postgres=# \?
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 [(OPTIONS)] [FILE] execute query (and send results to file or |pipe);
\g with no arguments is equivalent to a semicolon
\gdesc describe result of query, without executing it
\gexec execute query, then execute each value in its result
\gset [PREFIX] execute query and store results in psql variables
\gx [(OPTIONS)] [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
...