Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b88k7-0008U1-4K for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Jun 2016 16:11:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b88k6-0002PT-NQ for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Jun 2016 16:11:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b88jU-0001Fr-6q for pgsql-bugs@postgresql.org; Wed, 01 Jun 2016 16:11:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b88jP-0005yR-Py for pgsql-bugs@postgresql.org; Wed, 01 Jun 2016 16:10:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u51GAqsI013952; Wed, 1 Jun 2016 12:10:53 -0400 From: Tom Lane To: yancya@upec.jp cc: pgsql-bugs@postgresql.org, Kevin Grittner Subject: Re: BUG #14169: Incorrect merge join result in 9.5 In-reply-to: <20160601065921.30388.33069@wrigleys.postgresql.org> References: <20160601065921.30388.33069@wrigleys.postgresql.org> Comments: In-reply-to yancya@upec.jp message dated "Wed, 01 Jun 2016 06:59:21 -0000" Date: Wed, 01 Jun 2016 12:10:52 -0400 Message-ID: <13951.1464797452@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) 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 yancya@upec.jp writes: > TRAP: FailedAssertion("!(compareResult < 0)", File: "nodeMergejoin.c", Line: > 942) This is not a mergejoin logic bug, because nodeMergejoin.c didn't change significantly between 9.4 and 9.5. It must be that the input data is not being delivered in the expected order. I first thought that Peter G's sorting optimizations must be at fault, but if you run either of the mergejoin's subplans in isolation, you get correctly sorted data. What must be happening, then, is that mergejoin's mark/restore operations are confusing the btree indexscan and causing it to deliver the wrong tuple(s) after a restore. Armed with that conclusion about where the bug probably is, I looked through the git history, and soon found that the crash goes away if I manually revert commit 2ed5b87f96d473962ec5230fd820abfeaccb2069. In short: Kevin, you broke mark/restore. Please fix. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs