List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges ---+---+---+---+---+---+---+--- postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 | | libc | template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 ...
postgres=#CREATEDATABASEtestdb;CREATEDATABASEpostgres=#\lListofdatabasesName|Owner|Encoding|Collate|Ctype|Accessprivileges---+---+---+---+---+---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/postgrestemp...
postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ---+---+---+---+---+--- postgres | postgres | UTF8 | C | C | template0 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres |...
postgres=# \l+ List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges---+---+---+---+---+---+---+---advent_of_code
postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ---+---+---+---+---+--- postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 | template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres + | | | | | postgres=CTc/...
A single PostgreSQL server can contain many databases. Let’s explore three different approaches to list databases in PostgreSQL!
7. How do I get a list of databases in a Postgresql database ? # \l [Note: This is backslash followed by lower-case L] List of databases Name | Owner | Encoding ---+---+--- backup | postgres | UTF8 mydb | ramesh | UTF8 postgres...
postgres=# \l+ List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description ---+---+---+---+---+---+---+---+--- postgres | tbase | UTF8 | en_US.utf8 | en_US.utf8 | | 31 MB | pg_default | default administrative...
postgres=# \l+List of databases Name |Owner|Encoding|Collate|Ctype|Access privileges|Size|Tablespace|Description ---+---+---+---+---+---+---+---+--- postgres|postgres|SQL_ASCII|en_US.UTF8|en_US.UTF8||54 GB|pg_default|default administrative connection database template0|postgres|S...
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 + | | | ...