On Sun, Apr 15, 2012 at 12:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think it would be a good idea for UPDATE and DELETE to expose
>> a LIMIT option, but I can't really see the virtue in making that
>> functionality available only through SPI.
>
> FWIW, I'm not excited about that. You can get well-defined behavior
> today from a SELECT/LIMIT drawing from a writable CTE (namely, that
> the UPDATE/DELETE runs to completion but you only see a subset of
> its RETURNING result). LIMIT directly on the UPDATE/DELETE would be
> ill-defined, unless perhaps you want to also invent a way of specifying
> the order in which rows get selected for update; but I don't want to
> go there.
In the use cases I'm thinking of, it doesn't matter which row you
decide to update or delete, only that you pick a single one.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company