trigger for granting permission to select a table as soon it is created - Mailing list pgsql-novice

From santosh dwivedi
Subject trigger for granting permission to select a table as soon it is created
Date
Msg-id 20050107083708.90605.qmail@web52108.mail.yahoo.com
Whole thread Raw
Responses Re: trigger for granting permission to select a table as soon it is created  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
 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
 


 
Regards:
Santosh Dwivedi  
Software Engineer.   
Wireless People     22A persiaran zaaba
Taman Tun Dr Ismail                             
 60000 Kuala Lumpur, Malysia.


Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

pgsql-novice by date:

Previous
From: Dirk Cleenwerck
Date:
Subject: Updating views : cannot figure out what goes wrong
Next
From: Michael Fuhr
Date:
Subject: Re: trigger for granting permission to select a table as soon it is created