1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add List All The Databases as a postgres til

This commit is contained in:
jbranchaud
2016-03-06 14:59:18 -06:00
parent 51f8348457
commit 4ed73fc685
2 changed files with 17 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
warrant a full blog post. These are mostly things I learn by pairing with
smart people at [Hashrocket](http://hashrocket.com/).
_356 TILs and counting..._
_357 TILs and counting..._
---
@@ -175,6 +175,7 @@ _356 TILs and counting..._
- [Limit Execution Time Of Statements](postgres/limit-execution-time-of-statements.md)
- [List All Columns Of A Specific Type](postgres/list-all-columns-of-a-specific-type.md)
- [List All Rows In A Table](postgres/list-all-rows-in-a-table.md)
- [List All The Databases](postgres/list-all-the-databases.md)
- [List All Versions Of A Function](postgres/list-all-versions-of-a-function.md)
- [List Available Schemas](postgres/list-available-schemas.md)
- [List Connections To A Database](postgres/list-connections-to-a-database.md)

View File

@@ -0,0 +1,15 @@
# List All The Databases
There are two ways to list all the available databases. The first is a
`psql` only command:
```
\list
```
The second approach is to query the `pg_database` table. Something like the
following will suffice:
```sql
select datname from pg_database;
```