List tables in a PostgreSQL schema

前端 未结 4 1336
攒了一身酷
攒了一身酷 2020-12-12 08:40

When I do a \\dt in psql I only get a listing of tables in the current schema (public by default).

How can I get a list of all tables in al

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 09:19

    For those coming across this in the future:

    If you would like to see a list of relations for several schemas:

    $psql mydatabase
    mydatabase=# SET search_path TO public, usa;   #schema examples
    SET
    mydatabase=# \dt
                  List of relations
     Schema |      Name       | Type  |  Owner
    --------+-----------------+-------+----------
     public | counties        | table | postgres
     public | spatial_ref_sys | table | postgres
     public | states          | table | postgres
     public | us_cities       | table | postgres
     usa    | census2010      | table | postgres
    

提交回复
热议问题