Re: Getting list of columns in a table
| От | Jason Earl |
|---|---|
| Тема | Re: Getting list of columns in a table |
| Дата | |
| Msg-id | 87lm5z9j5w.fsf@npa01zz001.simplot.com обсуждение исходный текст |
| Ответ на | Getting list of columns in a table (Mike Blackwell <mblackwell@wallace.com>) |
| Список | pgsql-general |
The trick is to fire up psql with -E flag. That causes psql to spit out the SQL it uses to query the system tables for things like: \d tablename I believe that the query you need is: SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname = 'schedule' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum; Jason Mike Blackwell <mblackwell@wallace.com> writes: > Sorry if this is a FAQ, but didn't see it in the web site FAQ or in the > docs I have. > > I need a SQL statement which will return a list of the column names for > a (possibly empty) table. FWIW, I'm using Perl and DBI. > > TiA, > Mike > mblackwell@wallace.com > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
В списке pgsql-general по дате отправления: