Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Ch6-0002Fq-Gq for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2022 14:43:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2Ch5-00047C-Ce for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2022 14:43:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Ch5-000472-3f for pgsql-hackers@lists.postgresql.org; Mon, 05 Dec 2022 14:43:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Cgy-0002Wi-RD for pgsql-hackers@lists.postgresql.org; Mon, 05 Dec 2022 14:43:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2B5EhZcF3175243; Mon, 5 Dec 2022 09:43:35 -0500 From: Tom Lane To: Ashutosh Bapat cc: pgsql-hackers@lists.postgresql.org Subject: Re: Missing MaterialPath support in reparameterize_path_by_child In-reply-to: References: <1854233.1669949723@sss.pgh.pa.us> <1935226.1669995790@sss.pgh.pa.us> Comments: In-reply-to Ashutosh Bapat message dated "Mon, 05 Dec 2022 16:39:42 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3175241.1670251415.1@sss.pgh.pa.us> Date: Mon, 05 Dec 2022 09:43:35 -0500 Message-ID: <3175242.1670251415@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ashutosh Bapat writes: > partition-wise join should be willing to fallback to non-partitionwise > join in such a case. After spending a few minutes with the code, I > think generate_partitionwise_join_paths() should not call > set_cheapest() is the pathlist of the child is NULL and should just > wind up and avoid adding any path. We clearly need to not call set_cheapest(), but that's not sufficient; we still fail at higher levels, as you'll see if you try the example Richard found. I ended up making fe12f2f8f to fix this. I don't especially like "rel->nparts = 0" as a way of disabling partitionwise join; ISTM it'd be clearer and more flexible to reset consider_partitionwise_join instead of destroying the data structure. But that's the way it's being done elsewhere, and I didn't want to tamper with it in a bug fix. I see various assertions about parent and child consider_partitionwise_join flags being equal, which we might have to revisit if we try to make it work that way. regards, tom lane