Boa noite pessoal,

Pesquisando na web ( 
https://pt.wikibooks.org/wiki/PostgreSQL_Pr%C3%A1tico/Metadados ) consegui 
encontrar a seguinte query:

SELECT n.nspname as esquema, c.relname as tabela, a.attname as campo, 
format_type(t.oid, null) as tipo_de_dado,
       a.attnotnull as not_null, a.attnum::integer as position
FROM pg_namespace n, pg_class c, 
      pg_attribute a, pg_type t      
WHERE n.oid = c.relnamespace
   and c.relkind = 'r'     -- no indices
   and n.nspname not like 'pg\\_%' -- no catalogs
   and n.nspname != 'information_schema' -- no information_schema
   and a.attnum > 0        -- no system att's
   and not a.attisdropped   -- no dropped columns
   and a.attrelid = c.oid
   and a.atttypid = t.oid   
   and c.relname='ft_pedido' -- minha tabela
   ORDER BY attnum;

Ela me atende parcialmente, gostaria que me retornasse TAMBÉM JUNTAMENTE os 
seguintes campos:

PK (Sim/Não)
FK (Sim/Não)
Default (Valor padrão)

Desde já agradeço,
Allan de Sá
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a