From: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de> |
---|---|
To: | jman(at)equityunderwriters(dot)com(dot)hk |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Question II |
Date: | 2002-12-11 09:56:09 |
Message-ID: | 3DF70BB8.A64AF0E5@rodos.fzk.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2002-12-11 09:58:07 | Re: Adding foreign key constraint post table creation |
Previous Message | Christoph Haller | 2002-12-11 09:06:39 | Re: sql query |