How Do You List the Tables of a Specific Postgres Database?

Problem scenario
You want to see the names of the tables of a specific Postgres database.  You know the Postgres database name.  How do you do list its tables?

Solution
This assumes you have a role (a username and password) to connect to the Postgres database.

1.  Connect to the Postgres database (e.g., either through a web front-end or the command line interface).  If you are unsure on how to do this, see this link.

2.  Connect to the database with a command like this:
\c nameofdatabase \\where nameofdatabase is the name of the database you want

3.  Run this SQL command:
\dt

Leave a comment

Your email address will not be published.