information_schema for all users

From: "Luca Giandoso" <luca(dot)giandoso(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: information_schema for all users
Date: 2006-07-09 07:52:35
Message-ID: 3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I wold like to make a plpgsql function that return column names and
their data types of a specific table.
I have done this using:

CREATE OR REPLACE FUNCTION _get_table_definition(refcursor) RETURNS
refcursor SECURITY DEFINER AS
$$
DECLARE
BEGIN
OPEN $1 FOR SELECT column_name as field_name, data_type as
field_type FROM information_schema.columns WHERE
table_name='_table_name';
RETURN $1;
END;
$$ LANGUAGE plpgsql;

but it works only with the database owner although i have used
"SECURITY DEFINER".
How can I make it works for everyone that calls the function?

I use PostgreSQL 8.1.4

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message mbobi 2006-07-09 08:33:44 distinct with sum
Previous Message Richard Broersma Jr 2006-07-09 05:56:26 Re: table joining duplicate records