Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLawr-008t4a-A5 for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jan 2024 03:32:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rLawp-00HKfx-VD for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jan 2024 03:32:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLawp-00HKfp-Ip for pgsql-bugs@lists.postgresql.org; Fri, 05 Jan 2024 03:32:39 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLawj-00Fbde-1X for pgsql-bugs@lists.postgresql.org; Fri, 05 Jan 2024 03:32:39 +0000 Received: from [192.168.1.40] (cm-27-145-164-87.revip12.asianet.co.th [27.145.164.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 22BA2E20E4A; Fri, 5 Jan 2024 06:32:29 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1704425551; bh=/wqVDPMDV7b6i9QsejrrmmuGs+QAjpSkftrXFKPVmrI=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=quQKCTMHt6/BsonSIsNLDPJ8B98DJD2nvMdc2qXQZHTmoiU71f1L0ajdKyI2nC6+7 HP7VbhJI+qhbUXa6egsXFpxIrAMGQd/kdbhciMdcMRNG4UnH2M12KdUJD34pFInKp6 +Vpt0gIBN1P85S4qeAuacAqcRr6EQ5E2ZhhzAAP+5igDmNt6sF3I6cENCaHhbCk8Ab GQu9DilO+YQ60yS0rDg22RLeX/DxBRQuZfCi+alUn/Fw7jK8sc437L62SOTCUIGUyd +scVYcM4R12ST0lxcjDUTQuvutfGp0GXnT2i9afUP1BW78QMU8nBbw+nAsawIEyb/A uzisdEKQU2low== Content-Type: multipart/mixed; boundary="------------mt9skPaibCGJVCy5K3qDjFC6" Message-ID: Date: Fri, 5 Jan 2024 10:32:26 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18261: Inconsistent results of SELECT affected by joined subqueries To: Alexander Korotkov , Tom Lane Cc: Richard Guo , zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org References: <18261-2a75d748c928609b@postgresql.org> <2887250.1703781175@sss.pgh.pa.us> Content-Language: en-US From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------mt9skPaibCGJVCy5K3qDjFC6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/1/2024 15:02, Alexander Korotkov wrote: > On Thu, Dec 28, 2023 at 6:32 PM Tom Lane wrote: >> I'd say that that will break the cases rinfo_serial was introduced for. >> Now, I certainly don't love rinfo_serial and would be happier if we >> could do without it, but getting rid of it is another research project. > > It's a pity that no regression tests detect that. The attached patch > implements the special comparison function, which ignores the > 'rinfo_serial' field. This avoids marking 'rinfo_serial' as > pg_node_attr(equal_ignore). I've reviewed this patch, and it seems okay. It was a real blunder in our understanding of clauses; thanks to all for pointing this out and fixing it. The regression test shows where two fully equal join clauses, applied on different join levels, differ by the only required_relids. It covers the problem and can be helpful by itself. IMO, one line in this test is redundant (see attachment). The comment on the patch looks okay. But assuming required_relids and clause fields of two RestrinctInfos are equal, I can't imagine a situation to have different is_pushed_down and incompatible_relids. Is it really possible? -- regards, Andrei Lepikhov Postgres Professional --------------mt9skPaibCGJVCy5K3qDjFC6 Content-Type: text/plain; charset=UTF-8; name="tests_arrangement.diff" Content-Disposition: attachment; filename="tests_arrangement.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy90ZXN0L3JlZ3Jlc3MvZXhwZWN0ZWQvam9pbi5vdXQgYi9zcmMv dGVzdC9yZWdyZXNzL2V4cGVjdGVkL2pvaW4ub3V0CmluZGV4IGZhYWQ4ODJhMDMuLjA2MzM5 NmFiNTIgMTAwNjQ0Ci0tLSBhL3NyYy90ZXN0L3JlZ3Jlc3MvZXhwZWN0ZWQvam9pbi5vdXQK KysrIGIvc3JjL3Rlc3QvcmVncmVzcy9leHBlY3RlZC9qb2luLm91dApAQCAtNjg4MSw3ICs2 ODgxLDYgQEAgV0hFUkUgdDEuaWQgPSBlbXAxLmlkIFJFVFVSTklORyBlbXAxLmlkLCBlbXAx LmNvZGU7CiAoMyByb3dzKQogCiAtLSBDaGVjayB0aGF0IFNKRSBkb2VzIG5vdCBtaXN0YWtl bmx5IG9taXQgcXVhbCBjbGF1c2VzIChidWcgIzE4MTg3KQotaW5zZXJ0IGludG8gZW1wMSB2 YWx1ZXMgKDEsIDEpOwogZXhwbGFpbiAoY29zdHMgb2ZmKQogc2VsZWN0IDEgZnJvbSBlbXAx IGZ1bGwgam9pbgogICAgIChzZWxlY3QgKiBmcm9tIGVtcDEgdDEgam9pbgpkaWZmIC0tZ2l0 IGEvc3JjL3Rlc3QvcmVncmVzcy9zcWwvam9pbi5zcWwgYi9zcmMvdGVzdC9yZWdyZXNzL3Nx bC9qb2luLnNxbAppbmRleCA0ZjNjNTFiNmViLi41YzQyMGE3YzZkIDEwMDY0NAotLS0gYS9z cmMvdGVzdC9yZWdyZXNzL3NxbC9qb2luLnNxbAorKysgYi9zcmMvd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