X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id DCCBA9FA65C for ; Sun, 9 Jul 2006 04:52:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 90407-09 for ; Sun, 9 Jul 2006 04:52:37 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id 4511B9FA666 for ; Sun, 9 Jul 2006 04:52:37 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so3540856pyd for ; Sun, 09 Jul 2006 00:52:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=qSk78DLe9FJBuGFDJOO75SQSlpQoXA5CY0y2UK9K/PIcFEM0qB73utk4Msuq3WJe1hAR/lxyPA/rxGh6bsMhTj+06Ukn8Gu6g0nolVFqDBfXv8lghv8PYgAuC9Z2MjBTU6Pbu+Q6Vj6v3gj1adzmnWWfOy8uOUz4HRLg4ckO1c4= Received: by 10.35.101.9 with SMTP id d9mr3926709pym; Sun, 09 Jul 2006 00:52:36 -0700 (PDT) Received: by 10.35.129.13 with HTTP; Sun, 9 Jul 2006 00:52:35 -0700 (PDT) Message-ID: <3ac7d4e0607090052v4e401a85k927b81b002149e88@mail.gmail.com> Date: Sun, 9 Jul 2006 09:52:35 +0200 From: "Luca Giandoso" To: pgsql-sql@postgresql.org Subject: information_schema for all users MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/138 X-Sequence-Number: 25712 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