Display or show tables in a PostgreSQL/PgSQL database


From the PostgreSQL psql monitor, use the following command to view the tables in the current database:

\dt

The Conversation

Follow the reactions below and share your own thoughts.

7 Responses to “Display or show tables in a PostgreSQL/PgSQL database”

  1. May 24, 2010 at 10:45 am, noMan said:

    very old post :(

    Reply

    • September 09, 2010 at 9:03 pm, Joe said:

      So what? Still worked for me…

      Reply

  2. August 13, 2010 at 7:17 am, Marek Pe said:

    You can receive column comments in SQL:

    SELECT a.attname AS column, d.description AS COMMENT
    FROM pg_class c
    JOIN pg_description d ON c.oid=d.objoid
    JOIN pg_attribute a ON c.oid = a.attrelid
    WHERE c.relname=’monitors’
    AND a.attnum = d.objsubid

    Reply

  3. December 08, 2010 at 7:07 pm, Guest said:

    select
    ordinal_position,
    column_name,
    data_type,
    is_nullable,
    description.description as comment
    from
    information_schema.columns columns
    left join pg_class class on (columns.table_name = class.relname)
    left join pg_description description on (class.oid = description.objoid)
    left join pg_attribute attrib on (class.oid = attrib.attrelid and columns.column_name = attrib.attname and attrib.attnum = description.objsubid)
    where
    table_name=’{$tableName}’
    group by
    ordinal_position, column_name, data_type, is_nullable, description.description

    Reply

  4. July 13, 2011 at 6:46 pm, runa said:

    Thanks :) It worked

    Reply

  5. September 14, 2011 at 2:39 pm, Taller de creación literaria cinco letras said:

    not working :s

    Reply

  6. September 14, 2011 at 2:43 pm, Taller de creación literaria cinco letras said:

    Never mind, I did´t selected the db

    Reply

Leave a Reply