Re: simulating row ownership

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: simulating row ownership
Дата
Msg-id 20050107200617.GA91058@winnie.fuhr.org
обсуждение исходный текст
Ответ на simulating row ownership  ("Rick Schumeyer" <rschumeyer@ieee.org>)
Список pgsql-sql
On Fri, Jan 07, 2005 at 11:52:07AM -0500, Rick Schumeyer wrote:

> I have a table where I want everyone to be able to be able to insert and
> select.
> 
> But they should only be able to update and delete rows that they "own".  The
> table has a column indicating the owner.

What does the owner column refer to?  A database user?  If so, then
you could use a trigger that checks CURRENT_USER or SESSION_USER
and raises an exception if the user doesn't have permission to
update or delete the affected row.  In the PostgreSQL documentation,
see the "Triggers" chapter and the "Trigger Procedures" section of
the "PL/pgSQL - SQL Procedural Language" chapter.

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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: View with Union and update rule - fails
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: [JDBC] Calling a table in another database from plpgsql