Re: pg view of table columns needed for scripting

Поиск
Список
Период
Сортировка
От Chris Barnes
Тема Re: pg view of table columns needed for scripting
Дата
Msg-id BLU149-W3E175B31EEB21963884BDD45E0@phx.gbl
обсуждение исходный текст
Ответ на pg view of table columns needed for scripting  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Список pgsql-general



From: dave.gauthier@intel.com
To: pgsql-general@postgresql.org
Date: Fri, 22 Oct 2010 09:14:01 -0700
Subject: [GENERAL] pg view of table columns needed for scripting

.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal {margin-bottom:.0001pt;font-size:11.0pt;font-family:'Calibri','sans-serif';} .ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink {color:blue;text-decoration:underline;} .ExternalClass a:visited, .ExternalClass span.ecxMsoHyperlinkFollowed {color:purple;text-decoration:underline;} .ExternalClass span.ecxEmailStyle17 {font-family:'Calibri','sans-serif';color:windowtext;} .ExternalClass .ecxMsoChpDefault {;} @page WordSection1 {size:8.5in 11.0in;} .ExternalClass div.ecxWordSection1 {page:WordSection1;}

Hi:

 

Is there something like a pg_xxx view that I can use to get the column names and data types of a table, similar to what I see with \d ?  I need to run this is a script, so \d isn't viable.  I did a \df and looked around, but nothing popped out.

 

Thanks in Advance !





Specify the table name where like..

SELECT table_schema,table_name,column_name,data_type
FROM information_schema.columns
WHERE table_name like 't%'
and column_name = 'name_of_column_here' ORDER BY table_name
;


 table_schema  |            table_name             |  column_name  |     data_type    
---------------+-----------------------------------+---------------+-------------------
schema           | table                                 | column_name   | character varying


Chris

В списке pgsql-general по дате отправления:

Предыдущее
От: bricklen
Дата:
Сообщение: Re: pg view of table columns needed for scripting
Следующее
От: Miroslav Šulc
Дата:
Сообщение: Another PostgreSQL Diff Tool 2.3 released