pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luca Giandoso <luca.giandoso@gmail.com>
To: pgsql-sql@postgresql.org
Subject: information_schema for all users
Date: Sun, 9 Jul 2006 09:52:35 +0200
Message-ID: <3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com>
Permalink:  ../3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com/
Also on:    postgresql.org/message-id/3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com

 · 

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: luca.giandoso@gmail.com
  Subject: Re: information_schema for all users
  In-Reply-To: <3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com>

* 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