Command |
Significance |
\? |
List all Psql internal commands |
\a |
Toggles between table alignment and non-aligned mode. |
\c[onnect] [dbname|-[user]] |
Connect to the new database, and use "-" as the database name to connect to the default database. Database can be connected by user identity |
\c < title > |
Sets the title of the output table; The function is the same as "\pset title" |
\CD < catalogue > |
Change the working directory |
\copy ... |
Perform SQL COPY with data stream to the client machine. |
\copyright |
Display the use and release terms of PostgreSQL |
\d < table > |
Description table (or view, index, sequence builder) |
\D{T|I|S|V} |
List table/index/Sequence builder/view |
\d{p| S|L} |
List access Permissions/system tables/Large Objects |
\da |
List aggregates (aggregates) |
\db |
List table Spaces |
\dc |
List conversions |
\dc |
List casts |
\dd [Object] |
List notes for a table, type, function, or action |
\dd |
List domains |
\df |
List functions (custom functions??? ) need to verify |
\dg |
List groups |
\dl |
List large objects; You can also write "\lo_list" |
\dn |
List patterns |
\do |
List operators |
\dt |
List data types |
\du |
List users |
\e [File] |
Edit the current query buffer or file specified by using the external editor |
\echo < text > |
Print text to standard output |
\encoding < coding > |
Set up client-side encoding |
\f < separators > |
To modify the delimiter for an output field |
\g [file name] |
Send the results of the query to the backend (result output to file or | pipeline) |
\h [command] |
Displays help for SQL commands; * Indicates a detailed description of all commands |
\h |
Turn on HTML mode |
\i < file name > |
Read and execute a query from a file |
\l |
List all the databases |
\lo_export,\lo_import, \lo_list,\lo_unlink |
Performing large object operations |
\o [file name] |
Send all query results to a file or | pipeline |
\p |
Displays the contents of the current query buffer |
\pset < options > |
To set the table output options, you can set the options to one of the following: Format,border,expanded,fieldsep,footer,null,recordsep,tuples_only,title,tableattr, Pager |
\q |
Exit Psql |
\qecho < text > |
Writing text to the query output stream (refer to the \o command) |
\ r |
Reset (empty) the query buffer |
\s [file name] |
Print history or save history in a file |
\set < variables > < values > |
Set internal variables |
\ t |
Show rows only (toggle between modes) |
\ t < tags > |
Set the markup for the HTML table; the same function as "\pset tableattr" |
\timing |
Displays the time when the command was executed (toggle between the display and not showing the two modes) |
\z |
List access permissions for tables, views, and sequence generators |
\! Command |
Switch to the shell or execute a shell command |