From: Michael Fuhr <mike@fuhr.org>
To: Rick Schumeyer <rschumeyer@ieee.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: simulating row ownership
Date: Fri, 7 Jan 2005 13:06:17 -0700
Message-ID: <20050107200617.GA91058@winnie.fuhr.org> (raw)
In-Reply-To: <001901c4f4d9$395726f0$0200a8c0@dell8200>
References: <001901c4f4d9$395726f0$0200a8c0@dell8200>
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/
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@fuhr.org, rschumeyer@ieee.org
Subject: Re: simulating row ownership
In-Reply-To: <20050107200617.GA91058@winnie.fuhr.org>
* 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