Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TaQDF-00023i-F6 for pgsql-hackers@postgresql.org; Mon, 19 Nov 2012 12:12:29 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TaQDD-00086Q-L2 for pgsql-hackers@postgresql.org; Mon, 19 Nov 2012 12:12:29 +0000 Received: from anarazel.de (p5DDC7C56.dip.t-dialin.net [93.220.124.86]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Lz0c4-1TEc4A05r6-0140NS; Mon, 19 Nov 2012 13:12:26 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 48CAF1C00E5; Mon, 19 Nov 2012 13:12:25 +0100 (CET) Date: Mon, 19 Nov 2012 13:12:25 +0100 From: Andres Freund To: Alvaro Herrera Cc: pgsql-hackers@postgresql.org Subject: Re: foreign key locks Message-ID: <20121119121225.GB28067@awork2.anarazel.de> References: <4FEAB90A0200002500048B7D@gw.wicourts.gov> <1346389151-sup-8379@alvh.no-ip.org> <20121018195820.GO3763@alvh.no-ip.org> <201210270006.54728.andres@2ndquadrant.com> <20121114152347.GA5161@alvh.no-ip.org> <20121114162726.GE5161@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121114162726.GE5161@alvh.no-ip.org> X-Provags-ID: V02:K0:kUqLG8md1r8Hxitybd8ueDvEzXma/5a3WRI2n5yK4wP jAqB1+EmZ0LqBGHkEKTbRRoAE404QrgG+MQT1hPbglQLiEJIl9 sOgAmRjJCwoGLlN0k2zeEwa0wAAsiRkauuAG81C6kSZJ0laVfA oS3LhhnPC57DTuVYrh+dhH5ndXqSrZOo3UjhWx6lc3pr6/hvye Ta9nFurFe0eGR7yGySxgxxx04qMbrVDM7LbL1ovmi+eC4hAAfF YIh4BJ9Sixpknd+rjJmEtikHL0Gdbm++Q6AsDWQsha61QyiNS0 pg65w6AdN+2/VK3P+njogtrjMK3fINsCuzQQk9mE7HxHHRJ2Di 9IZJ9ZulK77sa7j8dwkk912HYhEt4mgtgtOgrjG8m X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201211/1014 X-Sequence-Number: 216866 On 2012-11-14 13:27:26 -0300, Alvaro Herrera wrote: > Alvaro Herrera wrote: > > > > * In heap_lock_tuple's XMAX_IS_MULTI case > > > > > > [snip] > > > > > > why is it membermode > mode and not membermode >= mode? > > > > Uh, that's a bug. Fixed. As noticed in the comment above that snippet, > > there was a deadlock possible here. Maybe I should add a test to ensure > > this doesn't happen. > > Done: > https://github.com/alvherre/postgres/commit/df2847e38198e99f57e52490e1e9391ebb70d770 > > (I don't think this is worth a v24 submission). One more observation: /* * Get and lock the updated version of the row; if fail, return NULL. */ - copyTuple = EvalPlanQualFetch(estate, relation, LockTupleExclusive, + copyTuple = EvalPlanQualFetch(estate, relation, LockTupleNoKeyExclusive, That doesn't seem to be correct to me. Why is it ok to acquire a potentially too low locklevel here? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services