Re: offset and limit in update and subselect

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: offset and limit in update and subselect
Date: 2001-02-26 04:39:39
Message-ID: 3.0.5.32.20010226123939.008a0100@192.228.128.13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 11:16 PM 25-02-2001 -0500, Tom Lane wrote:
>
>Right. Only the first row is locked, but that doesn't help any. "order
>by random" sounds like it might be a good answer, if there aren't many
>rows that need to be sorted.

Yep. I'll just see what happens in the testing stages.

>> What would happen if I rewrite that query to:
>
>> update todo set pid = $mypid where exists ( select task id from todo where
>> pid = 0 for update limit 1);
>
>Right now you get
>
>ERROR: SELECT FOR UPDATE is not allowed in subselects
>
>This is something that could be fixed if FOR UPDATE were a plan node
>instead of a function done at the executor top level.

OK. Sounds like it won't be worth the trouble to do, plus deadlocks would
be real fun ;).

Cheerio,
Link.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-02-26 04:48:11 Re: [PATCHES] A patch for xlog.c
Previous Message Tom Lane 2001-02-26 04:28:46 Re: [PATCHES] A patch for xlog.c