Re: User Permissions - Mailing list pgsql-sql

From Tom Lane
Subject Re: User Permissions
Date
Msg-id 1617.1011313303@sss.pgh.pa.us
Whole thread Raw
In response to User Permissions  (Braum Meakes <braum@telus.net>)
List pgsql-sql
Braum Meakes <braum@telus.net> writes:
> I have a function that I've written in plpgsql.  In it I lock a table 
> before selecting a value and, depending on the value, either update the 
> record selected or insert a new one.  It works perfectly when I run it as a 
> super-user or as the owner of the table.  However, as a standard user I am 
> unable to lock the table.

[ eyeballs code ]  LOCK ... IN ACCESS SHARE MODE (ie, read lock)
requires SELECT privileges; all stronger forms of LOCK require UPDATE
and/or DELETE privileges.  This seems to be undocumented :-(.  Am
fixing the LOCK reference page now.

Per subsequent discussion, it's not real clear that you need LOCK at
all ... but the docs need to explain the privilege rules, since they're
not exactly obvious.
        regards, tom lane


pgsql-sql by date:

Previous
From: chester c young
Date:
Subject: Re: User Permissions
Next
From: "Josh Berkus"
Date:
Subject: UPDATE Query problem