select ... for update - Mailing list pgsql-sql

From Jie Liang
Subject select ... for update
Date
Msg-id 3A36A0A5.E778EECA@ipinc.com
Whole thread Raw
In response to Re: Foreign key constraint  (Jie Liang <jliang@jliang.ipinc.com>)
Responses Re: select ... for update
List pgsql-sql
> Hi,

How can I use select ... for update to update limit to update what I
select??
somewhat like:
select url,id from mytable for update order by priority,id limit 5;
I want update the id in above return like:
update mytable set allocatedto='whatever' where id in above return set.
Could I do it in one stmt.
And what is class_name in following:
SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]   expression [ AS name ] [, ...]   [ INTO [ TEMPORARY | TEMP ]
[TABLE ] new_table ]   [ FROM table [ alias ] [, ...] ]   [ WHERE condition ]   [ GROUP BY column [, ...] ]   [ HAVING
condition[, ...] ]   [ { UNION [ ALL ] | INTERSECT | EXCEPT } select ]   [ ORDER BY column [ ASC | DESC | USING
operator] [, ...] ]   [ FOR UPDATE [ OF class_name [, ...] ] ]   LIMIT { count | ALL } [ { OFFSET | , } start ]
 
can any one give me a example??

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com





pgsql-sql by date:

Previous
From: Jie Liang
Date:
Subject: Re: plpgsql
Next
From: Borek Lupoměský
Date:
Subject: Re: SQL parse error