Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 3EA2D9FA178 for ; Fri, 1 Dec 2006 11:12:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 13108-07 for ; Fri, 1 Dec 2006 11:12:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 300FE9FA173 for ; Fri, 1 Dec 2006 11:12:14 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kB1FC69O015835; Fri, 1 Dec 2006 10:12:07 -0500 (EST) To: Alvaro Herrera cc: Simon Riggs , pgsql-hackers@postgreSQL.org Subject: Re: FOR SHARE vs FOR UPDATE locks In-reply-to: <20061201113711.GC30441@alvh.no-ip.org> References: <1144.1164924373@sss.pgh.pa.us> <1164962544.3778.847.camel@silverbirch.site> <20061201113711.GC30441@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Fri, 01 Dec 2006 08:37:11 -0300" Date: Fri, 01 Dec 2006 10:12:06 -0500 Message-ID: <15834.1164985926@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/17 X-Sequence-Number: 94498 Alvaro Herrera writes: > I'm not sure we can use the simple "raise an ERROR" answer though, > because for users that would be a regression. I've reconsidered the idea of upgrading the outer xact's shared lock to exclusive: at first I thought that would be hard to implement correctly, but now I realize it's easy. Just re-use the XID that's in the multixact as the one to store as the exclusive locker, instead of storing our current subxact XID. In some cases this will be a subcommitted XID of the current subxact or a parent, but the locking semantics are the same, and even though we think such an XID is finished everyone else will see it as still live so the appearance of its XID in an XMAX field shouldn't be an issue. So that's what I propose doing. regards, tom lane