PSQL Quick Reference - Pivotal
[Pages:1]PSQL Quick Reference
General
\copyright \g [FILE] or \h [NAME] \q
show PostgreSQL usage and distribution terms execute query (and send results to file or |pipe) help on syntax of SQL commands, * for all commands quit psql
Query Buffer
\e [FILE] \ef [FUNCNAME] \p \r \s [FILE] \w FILE
edit the query buffer (or file) with external editor edit function definition with external editor show the contents of the query buffer reset (clear) the query buffer display history or save it to file write query buffer to file
Input/Output \copy ...
\echo [STRING] \i FILE \o [FILE] \qecho [STRING]
perform SQL COPY with data stream to the client host write string to standard output execute commands from file send all query results to file or |pipe write string to query output stream (see \o)
Formatting \a \C [STRING] \f [STRING] \H \pset NAME [VALUE]
\t [on|off] \T [STRING] \x [on|off]
toggle between unaligned and aligned output mode
set table title, or unset if none
show or set field separator for unaligned query output
toggle HTML output mode set table output option (NAME:= {format | border | expanded | fieldsep | footer | null | numericlocale | recordsep | tuples_only | title | tableattr | pager}) show only rows
set HTML tag attributes, or unset if none
toggle expanded output
Connection
\c[onnect] [DBNAME |
connect to new database
USER | HOST | PORT |
]
\encoding [ENCODING]
show or set client encoding
\password [USERNAME]
securely change the password for a user
\conninfo
display information about current connection
Variables
\prompt [TEXT] NAME \set [NAME [VALUE]] \unset NAME
prompt user to set internal variable set internal variable, or list all if no parameters unset (delete) internal variable
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
\db[+] [PATTERN]
list tablespaces
\dc[S] [PATTERN]
list conversions
\dC [PATTERN]
list casts
\dd[S] [PATTERN]
show comments on objects
\ddp [PATTERN]
list default privileges
\dD[S] [PATTERN]
list domains
\des[+] [PATTERN]
list foreign servers
\deu[+] [PATTERN]
list user mappings
\dew[+] [PATTERN]
list foreigndata wrappers
\df[antw][S+] [PATTERN] list [only agg/normal/trigger/window] functions
\dF[+] [PATTERN]
list text search configurations
\dFd[+] [PATTERN]
list text search dictionaries
\dFp[+] [PATTERN]
list text search parsers
\dg[+] [PATTERN]
list roles (groups)
\dFt[+] [PATTERN]
list text search templates
\di[S+] [PATTERN]
list indexes
\dl
list large objects, same as \lo_list
\do[S] [PATTERN]
list operators
\dp [PATTERN]
list table, view, and sequence access privileges
\dr[S+] [PATTERN]
list foreign tables
\drds [PATTERN1 [PATTERN2]]list perdatabase role settings
\ds[S+] [PATTERN]
list sequences
\dt[S+] [PATTERN]
list tables
\dT[S+] [PATTERN]
list data types
\du[+] [PATTERN]
list roles (users)
\dv[S+] [PATTERN]
list views
\dx [PATTERN]
list external tables
\l[+]
list all databases
\z [PATTERN]
same as \dp
Operating System
\cd [DIR] \timing [on|off] \! [COMMAND]
change the current working directory toggle timing of commands execute command in shell or start interactive shell
Large Objects
\lo_export LOBOID FILE \lo_import FILE [COMMENT] \lo_list \lo_unlink LOBOID
Large Object Operations
Rev. A01
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- managing rights in postgresql
- postgis spatial tricks
- developments in postgresql 9 0 presentation title
- porting from oracle to postgres v2
- sql programming
- psql 8 3 cheatsheet postgres online
- psql quick reference pivotal
- sql reference
- usaspending database archive recommended download and
- a journey down the amazon gabrielle roth postgresql
Related searches
- free excel quick reference sheet
- hospice eligibility quick reference guide
- sba loan quick reference guide
- excel vba quick reference pdf
- excel 2010 quick reference card
- sba quick reference guide 2019
- mla quick reference sheet
- excel 2016 quick reference pdf
- excel quick reference cards 2019
- apa quick reference sheet
- icd 10 quick reference sheets
- icd 10 quick reference list