pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
obtaining column names from tables or views
2+ messages / 2 participants
[nested] [flat]

* obtaining column names from tables or views
@ 2007-11-28 15:13  John van Zantvoort <snl.jydawg@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: John van Zantvoort @ 2007-11-28 15:13 UTC (permalink / raw)
  To: pgsql-sql

moin,

I've got a question. I'm scripting against an existing postgresql database
environment and need to tweak queries based on the columns in the views or
tables, how can if find these w/o querying the tables or views.

Currently I execute the querie and collect the columns but this is rather
expensive, silly and fails when the table or view is empty.

-- 
Met vriendelijke groeten/with kind regards

       John van Zantvoort

---
Most burning issues generate far more heat than light.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM d-- s:+ a C++ UL++++ P+++ L++ E--- W++ N+ o-- K- w
O M- V- PS+ PE- Y PGP++ t 5 X R- tv- b+ DI+ D+
G e h--- r++ y++
------END GEEK CODE BLOCK------

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: obtaining column names from tables or views
@ 2007-11-28 15:29  Richard Huxton <dev@archonet.com>
  parent: John van Zantvoort <snl.jydawg@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2007-11-28 15:29 UTC (permalink / raw)
  To: John van Zantvoort <snl.jydawg@gmail.com>; +Cc: pgsql-sql

John van Zantvoort wrote:
> moin,
> 
> I've got a question. I'm scripting against an existing postgresql database
> environment and need to tweak queries based on the columns in the views or
> tables, how can if find these w/o querying the tables or views.

There is a whole section of the manual devoted to the system catalogues:
  http://www.postgresql.org/docs/8.2/static/catalogs.html
Or there's the "information schema" which is in a standardised layout 
but doesn't include PG-specific details.
  http://www.postgresql.org/docs/8.2/static/information-schema.html

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-11-28 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28 15:13 obtaining column names from tables or views John van Zantvoort <snl.jydawg@gmail.com>
2007-11-28 15:29 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox