
fdmarp
(usa Debian)
Enviado em 06/12/2011 - 18:54h
Existe a opção \d tb!
banco_teste=# \d
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+----------
public | pg_bloat | view | postgres
public | produtos | table | fdmarp
public | setor | table | fdmarp
public | subsetor | table | fdmarp
public | teste | table | fdmarp
Só uma curiosidade ... se você utilizar a opção -E do psql ele te retorna a query que ele fez para obter o \d.
ex.:
psql -E banco_teste
banco_teste=# \d
********* 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",
pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v','S','')
AND n.nspname <> 'pg_catalog'
AND n.nspname <> 'information_schema'
AND n.nspname !~ '^pg_toast'
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
**************************
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+----------
public | pg_bloat | view | postgres
public | produtos | table | fdmarp
public | setor | table | fdmarp
public | subsetor | table | fdmarp
public | teste | table | fdmarp