On Wed, Sep 21, 2005 at 02:31:23PM -0400, Steve Manes wrote:
> I need to extract a SETOF column names for a table in plpgsql. How
> is this done?
You can do it in SQL.
CREATE OR REPLACE FUNCTION get_columns_for (
in_schema TEXT,
in_table TEXT
) RETURNS SETOF TEXT
LANGUAGE SQL
STRICT
AS $
Steve Manes wrote:
I need to extract a SETOF column names for a table in plpgsql. How is
this done?
A query such as this:
select * from information_schema.columns where table_name = 'table_name';
Will give you a bunch of information. For SET OF functions in general
take a look at:
http:/
On 9/21/05, Steve Manes <[EMAIL PROTECTED]> wrote:
> I need to extract a SETOF column names for a table in plpgsql. How is
> this done?
I got the queries for this by running psql with -E and then using \d
on a table. Use this function like so: SELECT * FROM
column_names('your_table');
CREATE OR
I need to extract a SETOF column names for a table in plpgsql. How is this
done?
Start up psql with the -E option. Then type "\dt tablename". This will
print out the SQL that psql runs to give you the column names. Maybe that
will do what you want?
-philip
---(en