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 1fYeIi-0007H6-67 for pgsql-general@arkaria.postgresql.org; Thu, 28 Jun 2018 21:18:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYeIe-00025T-45 for pgsql-general@arkaria.postgresql.org; Thu, 28 Jun 2018 21:17:56 +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 1fYeId-00025M-PK for pgsql-general@lists.postgresql.org; Thu, 28 Jun 2018 21:17:55 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fYeIa-0007sp-FL for pgsql-general@postgresql.org; Thu, 28 Jun 2018 21:17:54 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id EDD7147257; Thu, 28 Jun 2018 23:17:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id bKpC9vLFZDX6; Thu, 28 Jun 2018 23:17:46 +0200 (CEST) Message-ID: <1530220664.3220.2.camel@cybertec.at> Subject: Re: Analyze plan of foreign data wrapper From: Laurenz Albe To: Mathieu PUJOL , pgsql-general@postgresql.org Date: Thu, 28 Jun 2018 23:17:44 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mathieu PUJOL wrote: > I'am writing a foreign data wrapper. To avoid returning data for a column that is not used, I parse 'targetlist' and 'qual' of the Plan. > I'am able to find Var nodes but I can't figure out how i could now if this node is related to a column my foreign table. For a Var v, v->varattno contains the attribute number of the column. That is the same as the attnum column in pg_attribute. If v->varattno == 0, it is a whole-row reference, like in SELECT mytab FROM mytab; Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com