pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: jman@equityunderwriters.com.hk
Cc: pgsql-sql@postgresql.org
Subject: Re: Question II
Date: Wed, 11 Dec 2002 10:56:09 +0100
Message-ID: <3DF70BB8.A64AF0E5@rodos.fzk.de> (raw)

>
> I would like to get all field name of a table within a stored
procedure
> using pgsql. How to do it??
>
SELECT a.attname
FROM pg_class c, pg_attribute a
WHERE c.relname = '<your-table-name>'
  AND a.attnum > 0 AND a.attrelid = c.oid
ORDER BY a.attnum ;
gives you the field names of <your-table-name>.

If you start a psql session with the -E option, you can see how
\d <your-table-name> is sql-generated.

If you are asking for support how to write this pgsql function
(table name parameter, query, etc.), then refer to the documentation
or send another request.

Regards, Christoph




Message-ID: <3DF70BB8.A64AF0E5@rodos.fzk.de>
Permalink:  ../3DF70BB8.A64AF0E5@rodos.fzk.de/
Also on:    postgresql.org/message-id/3DF70BB8.A64AF0E5@rodos.fzk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, jman@equityunderwriters.com.hk
  Subject: Re: Question II
  In-Reply-To: <3DF70BB8.A64AF0E5@rodos.fzk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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