No select permission on a table but can query it

Started by Michele Petrazzo - Unipexover 17 years ago3 messagesgeneral
Jump to latest
#1Michele Petrazzo - Unipex
michele.petrazzo@unipex.it

I think that this is a strange question, but: I need to revoke the
select permission on a table, but I also need to leave, with a function,
a user do a query on column.
A real case can be that a user "test" cannot have the permissions for do
a "select * from articles", but for do a "select has_article('an_article')"
where has_article are:

FUNCTION has_article (text) RETURNS articles AS $$
SELECT * from articles WHERE id_article=$1;
$$ LANGUAGE SQL

Into my tries I receive always a
ERROR: permission denied for relation articles

It's there a solution?

Thanks,
Michele

#2Scott Marlowe
scott.marlowe@gmail.com
In reply to: Michele Petrazzo - Unipex (#1)
Re: No select permission on a table but can query it

On Wed, Oct 15, 2008 at 1:33 PM, Michele Petrazzo - Unipex srl
<michele.petrazzo@unipex.it> wrote:

I think that this is a strange question, but: I need to revoke the
select permission on a table, but I also need to leave, with a function,
a user do a query on column.
A real case can be that a user "test" cannot have the permissions for do
a "select * from articles", but for do a "select has_article('an_article')"
where has_article are:

Look up "security definer" for functions.

#3Michele Petrazzo - Unipex
michele.petrazzo@unipex.it
In reply to: Scott Marlowe (#2)
Re: No select permission on a table but can query it

Scott Marlowe wrote:

I think that this is a strange question, but: I need to revoke the
select permission on a table, but I also need to leave, with a function,
a user do a query on column.
A real case can be that a user "test" cannot have the permissions for do
a "select * from articles", but for do a "select has_article('an_article')"
where has_article are:

Look up "security definer" for functions.

It was!

Thanks,
MIchele