PostgreSQL: Show tables in PostgreSQL

后端 未结 24 2595
醉梦人生
醉梦人生 2020-11-28 16:58

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

24条回答
  •  迷失自我
    2020-11-28 17:35

    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.

提交回复
热议问题