Re: how to grant select on table using trigger

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: santosh dwivedi <mwanaag(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: how to grant select on table using trigger
Date: 2005-01-08 16:06:16
Message-ID: 20050108160616.GA5705@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

[Please copy the mailing list when you reply.]

On Sat, Jan 08, 2005 at 01:09:29AM -0800, santosh dwivedi wrote:

> I re-written the trigger and function like , run time it gives the following warning
> WARNING: Error occurred while executing PL/pgSQL function permitselect
> WARNING: line 2 at execute statement

Is that the complete message? Does anything else show up on your
screen or in the server logs? What statement did you execute that
caused these warnings? What version of PostgreSQL are you using?

> EXECUTE ''GRANT SELECT ON '' || quote_ident(NEW.query_table) || '' TO
> GROUP wp'';

What data type is query_table? I ran a test with query_table as a
TEXT column and the code you posted worked in 7.4.6 and 8.0.0rc4.
If query_table is some other type (e.g., OID), then you'll need to
convert it to a string that contains the table name.

Please post a self-contained example: all CREATE and other statements
that somebody could copy and paste into an empty database to reproduce
the problem. Please reduce the problem as much as possible: if a
table has 50 columns then we probably don't need to see them all --
if only one column is relevant then create a test table with just
that one column. That makes it easier for everybody (including you)
to see what's going on.

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jyry Kuukkanen 2005-01-08 22:20:14 Re: backup
Previous Message Michael Fuhr 2005-01-07 19:16:58 Re: error in start a Data base