postgresqlHow do I show databases in PostgreSQL?
To show databases in PostgreSQL, you can use the \l
command. This command will list all databases on the server, along with their sizes and owners. For example:
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
The parts of the code are:
\l
- the command to list the databasesName
- the name of the databaseOwner
- the owner of the databaseEncoding
- the encoding of the databaseCollate
- the collation of the databaseCtype
- the character type of the databaseAccess privileges
- the access privileges for the database
For more information, you can check out the official PostgreSQL documentation:
More of Postgresql
- How do I parse XML data using PostgreSQL?
- How can Zalando use PostgreSQL to improve its software development?
- How can I set a PostgreSQL interval to zero?
- How can I use PostgreSQL XOR to compare two values?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I use PostgreSQL for my project?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL XML functions to manipulate XML data?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
See more codes...