Last active
September 22, 2017 15:07
-
-
Save newmetl/aa8d323688cac71e7f08b3fa014210ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Apart from select statements you can use the following commands on psql prompt: | |
\d [NAME] describe table, index, sequence, or view | |
\d{t|i|s|v|S} [PATTERN] (add "+" for more detail) | |
list tables/indexes/sequences/views/system tables | |
\da [PATTERN] list aggregate functions | |
\db [PATTERN] list tablespaces (add "+" for more detail) | |
\dc [PATTERN] list conversions | |
\dC list casts | |
\dd [PATTERN] show comment for object | |
\dD [PATTERN] list domains | |
\df [PATTERN] list functions (add "+" for more detail) | |
\dg [PATTERN] list groups | |
\dn [PATTERN] list schemas (add "+" for more detail) | |
\do [NAME] list operators | |
\dl list large objects, same as \lo_list | |
\dp [PATTERN] list table, view, and sequence access privileges | |
\dT [PATTERN] list data types (add "+" for more detail) | |
\du [PATTERN] list users | |
\l list all databases (add "+" for more detail) | |
\z [PATTERN] list table, view, and sequence access privileges (same as \dp) | |
Open psql shell | |
psql -d template1 | |
List all roles | |
template1=# \du | |
List all databases | |
template1=# \l | |
Exit shell | |
\q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment