Since each connection is specific to a database, you can try running a shell script.
This script will select all the database names and then loop over them, listing all their tables.
#!/bin/bash
USERNAME=postgres
DBNAME=postgres # Initially connect to and get the list of databases
# Get a list of all databases except system databases, remove leading/trailing whitespace
databases=$(psql -U $USERNAME -d $DBNAME -t -A -c "SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname ASC;")
# Loop over each database and run the query
for db in $databases; do
echo "Database: $db"
echo "--------------------------------"
# Disable pager, remove headers, and run the query to fetch tables
tables=$(psql -U $USERNAME -d "$db" -P pager=off -t -A -c "SELECT tablename FROM pg_tables WHERE schemaname NOT IN ('pg_catalog', 'information_schema') ORDER BY tablename ASC;")
if [ -z "$tables" ]; then
echo " (No tables found)"
else
# Loop through the tables and format output
for table in $tables; do
echo " - $table"
done
fi
echo
done
I created this script via:
touch /bin/showtables
chmod +x /bin/showtables
vi /bin/showtables # paste script (above) and modify if needed
I ran the command above inside a postgres pod.