May 2018
Intermediate to advanced
576 pages
30h 25m
English
If you have access to psql, you can type the following command:
bash $ psql -l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges-----------+--------+----------+-------------+-------------+------------------- postgres | sriggs | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | template0 | sriggs | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/sriggs + | | | | | sriggs=CTc/sriggs template1 | sriggs | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/sriggs + | | | | | sriggs=CTc/sriggs(3 rows)
You can also get the same information while running psql by simply typing \l.
The information that we just looked at is stored in a PostgreSQL catalog table named pg_database. We can issue a SQL query directly against that table from any connection ...