From: santosh dwivedi <mwanaag@yahoo.com>
To: pgsql-admin@postgresql.org
Subject: how to grant select on table using trigger
Date: Fri, 7 Jan 2005 00:30:16 -0800 (PST)
Message-ID: <20050107083016.89344.qmail@web52108.mail.yahoo.com> (raw)
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!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mwanaag@yahoo.com
Subject: Re: how to grant select on table using trigger
In-Reply-To: <20050107083016.89344.qmail@web52108.mail.yahoo.com>
References: <20050107083016.89344.qmail@web52108.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox