Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faEpD-00071X-5M for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jul 2018 06:30:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1faEp9-0000Ag-BW for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jul 2018 06:30:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faEp9-00009t-14 for pgsql-hackers@lists.postgresql.org; Tue, 03 Jul 2018 06:30:03 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1faEp3-00084c-Ry for pgsql-hackers@postgresql.org; Tue, 03 Jul 2018 06:30:00 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w636TkXP022003; Tue, 3 Jul 2018 15:29:46 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id F0F1C638C87; Tue, 3 Jul 2018 15:29:45 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id E23D3638B5E; Tue, 3 Jul 2018 15:29:45 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id C4CD3400239; Tue, 3 Jul 2018 15:29:45 +0900 (JST) Subject: Re: pgsql: Clarify use of temporary tables within partition trees References: <20180702221650.GA2159@paquier.xyz> <20180703045502.GA26236@paquier.xyz> <20180703061119.GA11732@paquier.xyz> From: Amit Langote Message-ID: <5db5fe6e-4a73-6a24-09e4-060b9f132ea9@lab.ntt.co.jp> Date: Tue, 3 Jul 2018 15:29:36 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: David Rowley , Michael Paquier Cc: Robert Haas , Postgres hackers X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018/07/03 15:16, David Rowley wrote: > On 3 July 2018 at 18:11, Michael Paquier wrote: >> On Tue, Jul 03, 2018 at 06:00:46PM +1200, David Rowley wrote: >>> I think it should be backpatched to v11 and v10. Your original commit >>> went there too. I don't see any reason to do any different here than >>> what you did with the original commit. >> >> expand_partitioned_rtentry is new as of v11. Or you mean to tweak >> expand_inherited_rtentry() perhaps? I am not sure that it is worth it >> as the code has already diverged between 10 and 11. > > Oh right. I'd forgotten that changed in v11. I think the v10 code is > fine as is then. Sorry for jumping in late here. I have a comment on the patch. + /* if there are no partitions then treat this as non-inheritance case. */ + if (partdesc->nparts == 0) + { + parentrte->inh = false; + return; + } + Why is this not near the beginning of expand_partitioned_rtentry()? Also, ISTM, this code would be unreachable because expand_inherited_rtentry would not call here if the above if statement is true, no? I see the following two blocks in expand_inherited_rtentry before one gets to the call to expand_partitioned_rtentry: if (!has_subclass(parentOID)) { /* Clear flag before returning */ rte->inh = false; return; } and if (list_length(inhOIDs) < 2) { /* Clear flag before returning */ rte->inh = false; return; } Thanks, Amit