Show Postgres Tables
this works from the command line:
psql -d database_name -U role_name -c "\dn"
I'm setup with a local database and postgres role that match my computer login name, so I can just do:
psql -c "\dn"
To see a list of tables in a schema via SQL use:
SELECT * FROM pg_catalog.pg_tables WHERE schemaname = 'the_schema_name';
If you need a list of the schemas to know which one to pick, use:
SELECT * FROM pg_catalog.pg_namespace;
One you have the tables you can look at the structure with:
SELECT * FROM information_schema.columns WHERE table_name = 'example_table';
If you're using the
psql client on the command line, you can also do: