Search code examples
databasepostgresqlcommanddatabase-tabledbtable

How to show tables in PostgreSQL?


What's the equivalent to show tables (from MySQL) in PostgreSQL?


Solution

  • From the psql command line interface,

    First, choose your database

    \c database_name
    

    Then, this shows all tables in the current schema:

    \dt
    

    Programmatically (or from the psql interface too, of course):

    SELECT * FROM pg_catalog.pg_tables;
    

    The system tables live in the pg_catalog database.