Re: [GENERAL] column-level update privs + lock table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] column-level update privs + lock table
Date: 2010-11-30 03:06:55
Message-ID: AANLkTik7TKnKKETXTJV8xpW0MbMwzSU=Wm=67WauDMV-@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Nov 29, 2010 at 9:37 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> It seems to me that if we're really worried about which locks users
>> are allowed to take (and so far all of the worrying seems to lack a
>> solid basis in any sort of usability argument) we'd need to invent
>> some special-purpose permissions, perhaps one for each lock level.
>
> OK, so here's why I wanted column-level update + lock table
> privileges. I put together a database application related to
> table-synchronization -- basically performing remote table
> comparisons. This application needed to update only a single column in
> the source table (an updated timestamp), but it needed to be certain
> that the source table wasn't changing underneath it.

Reasonable... but it doesn't seem unimaginable that someone could want
the opposite behavior, either, for the reasons I stated upthread.

>> And we might also want custom permissions for ANALYZE and VACUUM and
>> each subcommand of ALTER TABLE.  The question is, how much of that has
>> any real benefit?  It's probably uncommon to want to dole out such
>> fine-grained permissions, and our current permissions-granting
>> infrastructure tops out at 16 individual permissions, so it would need
>> some rework - particularly, to minimize slowdown of the common case
>> where you DON'T care about any of these fiddly ultra-fine-grained user
>> rights.
>>
>> For LOCK TABLE (or ANALYZE), it appears to be simple to allow users to
>> lock the table in any mode you like by providing an appropriate
>> SECURITY DEFINER function.  So I think if people want a user who can
>> update a single column of the table and also take an
>> AccessExclusiveLock we can just recommend that they do it that way.
>
> I actually hadn't thought of that, for some reason.
>
> We used to similarly recommend that people handle TRUNCATE privileges
> with a security definer function. That doesn't mean GRANT TRUNCATE
> wasn't a sweet addition to 8.4.

Hmm, glad you like it (I wrote that). I'm just asking how far we
should go before we decide we catering to use cases that are too
narrow to warrant an extension of the permissions system.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dusan Misic 2010-11-30 07:28:22 Re: PostgreSQL hanging on new connections?
Previous Message Josh Kupershmidt 2010-11-30 02:37:10 Re: [GENERAL] column-level update privs + lock table

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2010-11-30 03:09:15 Re: DELETE with LIMIT (or my first hack)
Previous Message Bruce Momjian 2010-11-30 03:03:44 Re: ALTER TABLE ... IF EXISTS feature?