On 27 October 2012 00:06, Andres Freund <and...@2ndquadrant.com> wrote: > On Thursday, October 18, 2012 09:58:20 PM Alvaro Herrera wrote: >> Here is version 22 of this patch. This version contains fixes to issues >> reported by Andres, as well as a rebase to latest master. > > Ok, I now that pgconf.eu has ended I am starting to do a real review: > > * Is it ok to make FOR UPDATE somewhat weaker than before? In 9.2 and earlier > you could be sure that if you FOR UPDATE'ed a row you could delete it. Unless > I miss something now this will not block somebody else acquiring a FOR KEY > SHARE lock, so this guarantee is gone.
Yes, that is exactly the point of this. > This seems likely to introduce subtle problems in user applications. Yes, it could. So we need some good docs on explaining this. Which applications use FOR UPDATE? Any analysis of particular situations would be very helpful in doing the correct thing here. I think introducing FOR DELETE would be much clearer as an addition/ synonym for FOR KEY UPDATE. > I propose renaming FOR UPDATE => FOR NO KEY UPDATE, FOR KEY UPDATE => FOR > UPDATE or similar (or PREVENT KEY UPDATE?). That keeps the old meaning of FOR > UPDATE. Which is essentially unwinding the feature, to some extent. Does FOR UPDATE throw an error if the user later issues an UPDATE of the PK or a DELETE? That sequence of actions would cause lock escalation in the application, which could also lead to deadlock/contention. This sounds like we need a GUC or table-level default to control whether FOR UPDATE means FOR UPDATE or FOR DELETE More thought/input required on this point, it seems important. > You write "SELECT FOR UPDATE is a standards-compliant exclusive lock". I > didn't really find all that much about the semantics of FOR UPDATE on cursors > in the standard other than "The operations of update and delete are permitted > for updatable cursors, subject to constraining Access Rules.". > * I think some of the longer comments could use the attention of a native > speaker, unfortunately thats not me. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers