permissions, exclusive row locks, and delete

From: Christian Lawrence <christian(dot)lawrence(at)calorieking(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: permissions, exclusive row locks, and delete
Date: 2013-06-03 23:35:00
Message-ID: 51AD2824.603@calorieking.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi!

I have a question, which I'm certain may be a bug, but I thought I'd
check with the community first before submitting it as one.

I have the following SQL pseudo code which obtains an exclusive row lock
before deleting the row:

SELECT * FROM sometable WHERE (id = :id) FOR UPDATE;
DELETE FROM sometable WHERE (id = :id);

The user account has SELECT and DELETE permissions on the table.
However, the SELECT FOR UPDATE will succeed only if the user account has
UPDATE permissions.

Is this a bug, or is there another way of obtaining an exclusive lock on
rows for delete without escalating permissions?

--
Christian Lawrence
Senior Developer
CalorieKing Wellness Solutions Incorporated
T: +618.9389.8777
F: +618.9389.8444
E: christian(dot)lawrence(at)calorieking(dot)com
W: www.calorieking.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel Wood 2013-06-04 02:24:55 Re: permissions, exclusive row locks, and delete
Previous Message Merlin Moncure 2013-05-31 20:40:41 Re: Copy to Csv file extremely slow