Skip to content

Instantly share code, notes, and snippets.

@efrecon
Created October 3, 2018 14:17
Show Gist options
  • Save efrecon/21ebe0214a4d34cbc176d39727da790c to your computer and use it in GitHub Desktop.
Save efrecon/21ebe0214a4d34cbc176d39727da790c to your computer and use it in GitHub Desktop.
List all tables in a given postgres db
echo "SELECT table_schema || '.' || table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema');" | psql -U postgres -d dbname -q -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment