Monday, 25 June 2018

How get a list of all the tables in a PostgreSQL database

You can get a list of all the tables in a PostgreSQL database with the built in psql functions or by executing a query:

PSQL

  1. Open psql and log into the database for which you want the list of tables
  2. Type \dt and press Enter
Query

You can also query pg_tables to get a list of tables in a database. You can filter on the schema name in the where clause:

No comments:

Post a Comment