see postgres databases code example
Example 1: postgresql show current database
SELECT current_database();
Example 2: postgresql list db
postgres=# \l
Example 3: postgres show databases
# List databases:
\l
Example 4: postgres how to list all databases
List all databases:
\l