Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ytvps-000848-BL for pgsql-bugs@arkaria.postgresql.org; Sun, 17 May 2015 10:30:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ytvpq-0001pd-EE for pgsql-bugs@arkaria.postgresql.org; Sun, 17 May 2015 10:30:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ytvpp-0001p8-EL for pgsql-bugs@postgresql.org; Sun, 17 May 2015 10:30:17 +0000 Received: from mx1.rootmx.com ([173.255.221.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Ytvpl-0000cg-2H for pgsql-bugs@postgresql.org; Sun, 17 May 2015 10:30:15 +0000 Received: from [192.168.200.33] (AMontsouris-655-1-63-179.w90-44.abo.wanadoo.fr [90.44.82.179]) by mx1.rootmx.com (Postfix) with ESMTPSA id 317722F5F3; Sun, 17 May 2015 10:30:08 +0000 (UTC) Message-ID: <55586DAF.5070303@realityexists.net> Date: Sun, 17 May 2015 12:30:07 +0200 From: Evan Martin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: BUG #13148: Unexpected deferred EXCLUDE constraint violation on derived table References: <20150424165722.2548.62492@wrigleys.postgresql.org> <30055.1431288113@sss.pgh.pa.us> In-Reply-To: <30055.1431288113@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 10/05/2015 10:01 PM, Tom Lane wrote: > The cause of the problem seems to be that the UPDATE performs a HOT update > of the new tuple, leaving in this case a dead tuple at (0,2) that is HOT > updated by (0,3). When unique_key_recheck() is invoked for (0,2), it > believes, correctly, that it has to perform the recheck anyway ... but it > tells check_exclusion_constraint that the check is being performed for > (0,2). So the index search inside check_exclusion_constraint finds the > live tuple at (0,3) and thinks that is a conflict. > > This is reproducible clear back to 9.0 where exclusion constraints were > added. > > The easiest fix seems to be to pass the HOT child's TID instead of the > TID we were called for. (Note that the other path, for a regular unique > constraint, is correct as-is because the original TID is what the index > will know about.) > > The attached patch seems to fix the problem without breaking any existing > regression tests, but I wonder if anyone can see a hole in it. > > regards, tom lane > Thanks very much for fixing this! Now that you know the cause, could you suggest any workaround? Also, any idea when the fix will be released? Will it be in 9.3.7 or 9.4.2 or only in 9.5.0? -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs