Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHnTk-0004ZM-Lq for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2015 06:26:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHnTk-0001t4-3z for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2015 06:26:08 +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.84) (envelope-from ) id 1ZHnTj-0001sx-Bp for pgsql-hackers@postgresql.org; Wed, 22 Jul 2015 06:26:07 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZHnTc-0008Ht-8B for pgsql-hackers@postgresql.org; Wed, 22 Jul 2015 06:26:06 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id t6M6PmoU004226; Wed, 22 Jul 2015 15:25:48 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id A9E3B5F611; Wed, 22 Jul 2015 15:25:48 +0900 (JST) Received: from imail3.m.ecl.ntt.co.jp (imail3.m.ecl.ntt.co.jp [129.60.5.248]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 9C3975F594; Wed, 22 Jul 2015 15:25:48 +0900 (JST) Received: from [129.60.241.75] ([129.60.241.75]) by imail3.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id t6M6Pm8J010827; Wed, 22 Jul 2015 15:25:48 +0900 Message-ID: <55AF3748.9080901@lab.ntt.co.jp> Date: Wed, 22 Jul 2015 15:25:12 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Rowley CC: PostgreSQL-development Subject: Re: Minor code improvements to create_foreignscan_plan/ExecInitForeignScan References: <559F9323.4080403@lab.ntt.co.jp> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Pg-Spam-Score: -3.8 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2015/07/10 21:59, David Rowley wrote: > On 10 July 2015 at 21:40, Etsuro Fujita > wrote: > > To save cycles, I modified create_foreignscan_plan so that it detects > whether any system columns are requested if scanning a base relation. > Also, I revised other code there a little bit. > > For ExecInitForeignScan, I simplified the code there to determine the > scan tuple type, whith seems to me complex beyound necessity. Maybe > that might be nitpicking, though. For the latter, I misunderstood that the latest foreign-join pushdown patch allows fdw_scan_tlist to be set to a targetlist even for simple foreign table scans. Sorry for that, but I have a concern about that. I'd like to mention it in a new thread later. > I just glanced at this and noticed that the method for determining if > there's any system columns could be made a bit nicer. > > /* Now, are any system columns requested from rel? */ > scan_plan->fsSystemCol = false; > for (i = FirstLowInvalidHeapAttributeNumber + 1; i < 0; i++) > { > if (bms_is_member(i - FirstLowInvalidHeapAttributeNumber, attrs_used)) > { > scan_plan->fsSystemCol = true; > break; > } > } > > I think could just be written as: > /* Now, are any system columns requested from rel? */ > if (!bms_is_empty(attrs_used) && > bms_next_member(attrs_used, -1) < -FirstLowInvalidHeapAttributeNumber) > scan_plan->fsSystemCol = true; > else > scan_plan->fsSystemCol = false; > > I know you didn't change this, but just thought I'd mention it while > there's an opportunity to fix it. Good catch! Will update the patch (and drop the ExecInitForeignScan part from the patch). Sorry for the delay. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers