Re: select ... for update limit 1 - Mailing list pgsql-general

From Tom Lane
Subject Re: select ... for update limit 1
Date
Msg-id 21160.982561910@sss.pgh.pa.us
Whole thread Raw
In response to select ... for update limit 1  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
List pgsql-general
Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> Right now select for update limit 1 seems to lock all rows in the where
> clause, not just retrieved rows.

This claim surprises me quite a lot, since the FOR UPDATE locking occurs
at the outer level of the executor where rows are about to be returned.
And I can't duplicate your result in a simple test.  Could you post a
reproducible example?

            regards, tom lane

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: select ... for update limit 1
Next
From: MMM
Date:
Subject: Foreign keys