Dá uma olhada no information_schema.columns, lá tem tudo, ou quase tudo, que vc 
pode vir a precisar.

Atenciosamente, 

 Andréa Pereira
 DBA-Compesa
 Recife-PE
----- Original Message ----- 
  From: jfranco 
  To: Comunidade PostgreSQL Brasileira 
  Sent: Monday, May 14, 2007 2:34 PM
  Subject: Re: [pgbr-geral] Consulta ao Catalogo do Pgsql


  Beleza, Mas como eu pegaria o campo de Descrição?
  
----------------------------------------------------------------------------------

   
  Em 14/05/07, Andrea <[EMAIL PROTECTED]> escreveu: 
    Oi J.Franco, 

    Espero que esta query ajude.

    -- lista tabelas , colunas:
      SELECT  table_name, column_name, data_type
      FROM  information_schema.columns

    E como achei que vc também ia precisar saber os índices. 
    Segue query:

    -- Relação de índices por schema/tabela
      SELECT n.nspname AS schema_name,
           bc.relname AS class_name,
           ic.relname AS index_name,
           a.attname
      FROM pg_namespace n,
           pg_class bc,             -- base class
           pg_class ic,             -- index class
           pg_index i,
           pg_attribute a           -- att in base 
      WHERE bc.relnamespace = n.oid
         and i.indrelid = bc.oid
         and i.indexrelid = ic.oid
         and i.indkey[0] = a.attnum
         and i.indnatts = 1
         and a.attrelid = bc.oid
      ORDER BY schema_name, class_name, index_name, attname; 

    Atenciosamente, 

     Andréa Pereira
     DBA-Compesa
     Recife-PE
      ----- Original Message ----- 
      From: jfranco 
      To: [email protected] 
      Sent: Friday, May 11, 2007 7:28 PM
      Subject: [pgbr-geral] Consulta ao Catalogo do Pgsql

       
      Estou reenviando a pergunta pq. o mederador rejeitou por engano.

      gostaria de saber como fazer uma consulta ao catalogo do Postgres,
       para obter o nome_das_tabelas,nome_da_coluna(field),tipo,descrição

      Grato.

      J.Franco


--------------------------------------------------------------------------


      _______________________________________________
      pgbr-geral mailing list
      [email protected] 
      https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral 



--------------------------------------------------------------------------


      No virus found in this incoming message.
      Checked by AVG Free Edition. 
      Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 
12:17






    _______________________________________________
    pgbr-geral mailing list
    [email protected] 
    https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral 






------------------------------------------------------------------------------


  _______________________________________________
  pgbr-geral mailing list
  [email protected]
  https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral



------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Free Edition. 
  Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a