Unix Technical Forum

trigger for granting permission to select a table as soon it is created

This is a discussion on trigger for granting permission to select a table as soon it is created within the pgsql Novice forums, part of the PostgreSQL category; --> HI I am using postgersql and i am newbie, i want to grant select permission to a group on ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 08:19 PM
santosh dwivedi
 
Posts: n/a
Default trigger for granting permission to select a table as soon it is created

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 08:19 PM
Michael Fuhr
 
Posts: n/a
Default Re: trigger for granting permission to select a table as soon it is created

On Fri, Jan 07, 2005 at 12:37:08AM -0800, santosh dwivedi wrote:

> i want to grant select permission to a group on table that will
> be created by me in future.


You also asked this question in pgsql-admin. See my answer there.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com