Re: Trx issues: SELECT FOR UPDATE LIMIT - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject Re: Trx issues: SELECT FOR UPDATE LIMIT
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA40184CD94@m0114.s-mxs.net
Whole thread Raw
In response to Trx issues: SELECT FOR UPDATE LIMIT  (James Mancz <james@mancz.com>)
List pgsql-hackers
> > client 2 can carry on processing now,
> > and its SELECT * FROM work WHERE alloc IS NULL LIMIT 1 FOR UPDATE;
> > **returns no rows** despite the fact the second row matches.
>
> This is annoying but I do not think it is readily fixable, because the
> LIMIT filter acts before the FOR UPDATE processing.  When FOR UPDATE
> rejects the first row because it's been changed by the previous updater,
> that's all she wrote --- the LIMIT's not gonna produce more rows.

At least there is a workaround for this:
Use a cursor without (or with a high eg 10000) LIMIT and stop fetching after
the 1000 wanted rows :-)

Andreas



pgsql-hackers by date:

Previous
From: "John Liu"
Date:
Subject: pattern match, index use and performance
Next
From: Patrick Macdonald
Date:
Subject: PITR: Proposed modifications to JR's design