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.98.2) (envelope-from ) id 1xSQbk-00000001pQj-2R1H for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Nov 2026 03:08:44 +0000 Received: from localhost ([127.0.0.1]:42422 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xSQbi-0000000EQ1D-1yUU for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Nov 2026 03:08:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:34816) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSQbh-0000000EQ14-3jwT for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 03:08:41 +0000 Received: from mail-yx1-xb131.google.com ([2607:f8b0:4864:20::b131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xSQbg-00000000zoQ-10WW for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 03:08:40 +0000 Received: by mail-yx1-xb131.google.com with SMTP id 956f58d0204a3-67990a45e02so2385139d50.3 for ; Sat, 14 Nov 2026 19:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794712119; x=1795316919; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=v1Z8p0yUUVxL/QXZaZPYDw+ByReK7nTv03/z01/jR1o=; b=V+A9eOjgYkWX2fHFWCCLRpwRV1YgVMVWvTf9JKodYhtwKq3oougG47Bwsb0AfkhIsc 96NFLkccBa/g3ZTo4047jsvnaW0hSX7/PwP9CrERRPWp8yFWuXIp+ojlLVjaH+XASEx9 kYrQw2nI5q6RJuJhMCGz9i/WuW36KojvASFtOWz7jOYzPtV0cRswedQfBIGolVJQUQNM 3mTBqFMM67tYdOQocyDyQJW3eqsEEImF1GKMFCoUaOpgWDxAJivHQ9hjhIDY+FFU/jrS kx/+cW+/zbofSPSsA2TKRPrj/uTaisB7VLEECMEB4087IJ98eMIl2x3KRlNvkHE8gZLK HJPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794712119; x=1795316919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=v1Z8p0yUUVxL/QXZaZPYDw+ByReK7nTv03/z01/jR1o=; b=M6+8BI2fil1kQ0ta5ax+mvUZYtq4PXK2UMlsemD9OSOU1qLYZk4SjYADNRK6XjJj+W zDXtW7rstss8+gjUSxWdmQDEwTp+tFpyBjkpTDsU0jpwlyO4fDkDMX4SPfUMFiJzEVhv ML+eSZ2d3flQT0VD93RHr5ErD/pAiow5e1ZnMBF6tq4NbecEjQLUukEc/Gvw0TPJIfEV LGbsJjqBTvjCllvxkbiPl0T9mpJWq6NfylH+zzpV1iISU73hWQ+sNDDMa59pXkNlMWBl UqJPhIg6A2loysSX3KrZ9uduJZZNXqmiVpWI1EL55Oc3t0x+w197MH9Z9kB1Gs300KNm pTsQ== X-Gm-Message-State: APuU4Z+9a4X2ev/r/NnaPeFMYwtLUL6CgXJMqG5d9CwmHdIiZFZ7PxH2 q5KZ4bZtiQb7/87YQWSMdMYWbhntACeB5hog7U3yO1p+aMMz10JlSMCq X-Gm-Gg: AYBFou0kqzj7TUWiwk4oLOGVXbLRvinknv+uwzq3yAku/hI8CqWlAZCUORhGP/allpW MUpf77w1q2xcvLWAbm1D7Ysq8MNB/PjjmN7YF6DhGr8iI1Mg9DylzLMAY3uy49+BUWocLNE+Wfg D/E61B00SfC311y0RAtrRP+eC1SdH96NUKZgEZyASsJQ+c9xlRC36+Q7E3kjVim/vfQl9uJ86aF tZgziIhXqu0S3emoVEv3NxDwsRzgjHZ8FIbuPvNlfkt15mgp3Q6GLTEVAPg8o7+a7DlVjKp0IPW IRvnaNKOGkCz3OHSdWYnCF7lUU+jDyOh2yXXXavNCn45LsZuT0Ymz19qb+E23rGcKTrVvlIP/mO 4f7wbglseFC5Ajd88VHzQaCytTrgxAIA+KpCUcndaCrW4jpG8XAQ3O1PA+UNRAglB6FaQxG119i tCX8HYm6wOlItWU7EyaWemt0uqgZauXGN4sIDOgyPpRFzO+WU0vNhji2qCHgkgZzpVB6cHTq6bE LsDeuGTbEhUhbR73PDHho6tjr9FxpouDwCK1auoW0IvHGSHR9KNnTYzJxYD1KTuVPmdSisMKvcy zyLDrGHAGu84aLxOWHCjb4GuOD6Ciz07glat1JGf5SKydg9AubEt5ElkhL8aU1r5wPrEJdzYbvH obek8GmJ3J7gbxcszns/PbBvVADrsm+eFvkqg5kbRSufoH6HrycdM+8EG3Yyn X-Received: by 2002:a05:690c:7482:b0:8ab:436f:6e77 with SMTP id 00721157ae682-8b4aa3b4919mr47438447b3.55.1794712119024; Sat, 14 Nov 2026 19:08:39 -0800 (PST) Received: from NOTEBOOK-LAILA ([2804:14d:5c27:1387:a053:f15d:8c82:ed64]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b4aaa0ea50sm56158447b3.42.2026.11.14.19.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 19:08:38 -0800 (PST) From: Joao Rito To: Tender Wang Cc: pgsql-bugs@lists.postgresql.org, Alperen Keles Subject: Re: BUG #19798: failed to build any 4-way joins Date: Sun, 15 Nov 2026 00:08:32 -0300 Message-ID: <20261115030832.1908-1-joaovictor.rito@gmail.com> X-Mailer: git-send-email 2.53.0.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Tender, I tested your patch on current master (81b2179b492, built with cassert and tap tests) and it applies cleanly. On master the reproducer from the report (ROLLUP over a LATERAL subquery that references the nullable side of a LEFT JOIN) fails with "failed to build any 4-way joins", and two more variants I wrote fail with the same error, one of them also with "failed to build any 5-way joins". With the patch all of them run, and for the cases where I wrote an equivalent UNION ALL query (the reproducer and two of the variant queries), the results match. The regress suite passes (243 tests). What I did not test: other forms such as CUBE, GROUPING SETS and RIGHT JOIN (I only ran the cases above), the isolation and tap suites, pgindent, the docs, the back branches, other platforms (I ran one Linux build), and the effect on plan quality or planning time. Small suggestions: the patch has no regression test, so it could add one with the reproducer to join.sql or groupingsets.sql. I have no objection to the change in joinrels.c from what I could test. Regards, Joao Rito