postgresql

Why does PostgreSQL's \dt show only public schema tables?


I have created a new schema in my PostgreSQl database with psql:

CREATE SCHEMA my_schema;

But when I issue the \dt command, I see only the tables that are in the public schema. However, I can access all the tables in my_schema with my_schema.table_name.

How can I see all the tables from all the schemas in psql?


Solution

  • For your schema (note the period after the schema name):

    \dt my_schema.*
    

    Or:

    SET search_path TO my_schema, public;
    \dt
    

    For all schemas:

    \dt *.*