Skip site navigation (1) Skip section navigation (2)

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

From: santosh dwivedi <mwanaag(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: trigger for granting permission to select a table as soon it is created
Date: 2005-01-07 08:32:19
Message-ID: 20050107083219.30121.qmail@web52102.mail.yahoo.com (view raw or flat)
Thread:
Lists: 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 
   

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

pgsql-novice by date

Next:From: Dirk CleenwerckDate: 2005-01-07 08:36:28
Subject: Updating views : cannot figure out what goes wrong
Previous:From: Ahmed SarwarDate: 2005-01-07 06:09:29
Subject: .sql howto

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group