Re: SQL Command - To List Tables ? - Mailing list pgsql-general

From Heath Tanner
Subject Re: SQL Command - To List Tables ?
Date
Msg-id E07DA604-D8FB-11D7-8044-0003930C11A0@interport.net
Whole thread Raw
In response to Re: SQL Command - To List Tables ?  (Carmen Gloria Sepulveda Dedes <csepulveda@atichile.com>)
Responses Re: SQL Command - To List Tables ?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
On Wednesday, August 27, 2003, at 09:17  AM, Carmen Gloria Sepulveda
Dedes wrote:

> Hello.  I type \dt as user postgres, but it show only the tables within
> public schema.  I need to know all tables (like v$_  or dba_ or user_
> in oracle).   How I do that?

Start psql with the echo flag:

[inligo:~] heath% psql -E dpe
********* QUERY **********
BEGIN; SELECT usesuper FROM pg_catalog.pg_user WHERE usename = 'heath';
COMMIT
**************************

Welcome to psql 7.3.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
        \h for help with SQL commands
        \? for help on internal slash commands
        \g or terminate with semicolon to execute query
        \q to quit

dpe=# \dt
********* QUERY **********
SELECT n.nspname as "Schema",
   c.relname as "Name",
   CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i'
THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as
"Type",
   u.usename as "Owner"
FROM pg_catalog.pg_class c
      LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner
      LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','')
       AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
       AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
**************************


-heath


pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: Buglist
Next
From: Heath Tanner
Date:
Subject: Re: Books for PostgreSQL?