X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E27F3A4211 for ; Fri, 7 Jan 2005 08:30:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97322-06 for ; Fri, 7 Jan 2005 08:30:16 +0000 (GMT) Received: from web52108.mail.yahoo.com (web52108.mail.yahoo.com [206.190.39.77]) by svr1.postgresql.org (Postfix) with SMTP id 9FA943A3AE7 for ; Fri, 7 Jan 2005 08:30:16 +0000 (GMT) Received: (qmail 89346 invoked by uid 60001); 7 Jan 2005 08:30:16 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=JfRV+bGN4R5p4nsykMzJa7QHlk+ekWRkz8Sj0lfLpK7sM7VgSEGdFDEJ1RsofyQ6RmC8u4jpXPwbfO8u+f6YG9/dlRGM3KN0C9b7/LexZZb7U4s5DVj/HB8woKnWaTqaqdmRsWe1vFuheTpXAAtqJZb4I8bHLOuG9ye1O0prOZ8= ; Message-ID: <20050107083016.89344.qmail@web52108.mail.yahoo.com> Received: from [218.111.252.82] by web52108.mail.yahoo.com via HTTP; Fri, 07 Jan 2005 00:30:16 PST Date: Fri, 7 Jan 2005 00:30:16 -0800 (PST) From: santosh dwivedi Subject: how to grant select on table using trigger To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1624639112-1105086616=:88211" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.461 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/40 X-Sequence-Number: 15899 --0-1624639112-1105086616=:88211 Content-Type: text/plain; charset=us-ascii HI I am using postgersql and i am newbie, i want to grant select permission to a group on table that will be created by me in future. so i used trigger and a function CREATE FUNCTION permitselect () RETURNS opaque AS 'DECLARE BEGIN GRANT SELECT ON NEW to GROUP wp; RETURN NEW; END; ' LANGUAGE 'plpgsql'; and trigger as CREATE TRIGGER permit_select AFTER INSERT OR UPDATE ON queries FOR EACH ROW EXECUTE PROCEDURE permitselect(); queries is table where meta data of tables created by me is stored. so new table created will be listed in table queries. but on execution it gives error: NEW used in non-rule query Error occurred while executing PL/pgSQL function permit Can any body help me how i can write a trigger for granting permission to select a table as soon it is created thanks in advance santosh dwivedi --------------------------------- Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! --0-1624639112-1105086616=:88211 Content-Type: text/html; charset=us-ascii
HI
I am using postgersql and i am newbie,
 
i want to grant select permission to a group on table that will be created by me in future.
so i used trigger and a function
 
CREATE FUNCTION permitselect () RETURNS opaque AS 'DECLARE BEGIN GRANT SELECT ON  NEW to GROUP wp; RETURN NEW;  END; ' LANGUAGE 'plpgsql';

and trigger as
CREATE TRIGGER permit_select
               AFTER INSERT OR UPDATE
                ON queries FOR EACH ROW
                EXECUTE PROCEDURE permitselect();
 
queries is table where meta data of tables created by me is stored. so new table created will be listed in table queries.
 
 
but on execution it  gives error:
NEW used in non-rule query
Error occurred while executing PL/pgSQL function permit
 
Can any body help me how i can write a trigger for granting permission to select a table as soon it is created
 
thanks in advance
santosh dwivedi
   


Do you Yahoo!?
All your favorites on one personal page – Try My Yahoo! --0-1624639112-1105086616=:88211--