Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cT94B-0000cY-2l for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2017 15:19:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cT949-000523-VP for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2017 15:19:26 +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_2) (envelope-from ) id 1cT92j-0003TI-KT for pgsql-hackers@postgresql.org; Mon, 16 Jan 2017 15:17:57 +0000 Received: from mail-vk0-x233.google.com ([2607:f8b0:400c:c05::233]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cT92e-0007lB-OM for pgsql-hackers@postgresql.org; Mon, 16 Jan 2017 15:17:56 +0000 Received: by mail-vk0-x233.google.com with SMTP id k127so29287238vke.0 for ; Mon, 16 Jan 2017 07:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=8PrJCg4rK8BUKc2IfflRSMl4kBeLHLpbiBne8wDLeR0=; b=yaiMH8Zm6VeoHBK+1gDsVN2yYfTw2reRndC/irqCPGMqmkPcQZg7V7WaNVryEN7oVP LIQipWIr2xz/34XbUh9nBKUQn0/Eb/+a2LQKN3u8C+TFeCO5sOMiE0B0+qyddlVP3phE rxsa0YvaGk5buQgR0+jF17OdwfBdve8tUQBgMM9/AYrRQKDFB+tzQ00/Qj1FVI8MA/LS udlSS835Jl/Kwex5gbHjrWPzCLy2dIRqWArPu6jiiQlivAMuRHFz3FLYLLa3JzZs6M+u QL7oRBco5UIb7R0AJAoXu1he6jBXHXIEaJiKjZ3q4WxtT/WIOIedNcShrCLcr/jSgbdO 7K3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8PrJCg4rK8BUKc2IfflRSMl4kBeLHLpbiBne8wDLeR0=; b=GjzonU2iSKZjYMX21dHTNVLdwm0SrsnTCCnmVq6lylmi90E/NTlw50jcJbKowoxBZ9 bAxfJi1tixla12sCa/2LEIPQcCQU0HKz0I9FK0b0lF1ZHTJEpSzZTqczYs+5fu8wdEY0 pMXEKu5+aSaXwuBP2tjCdV2gSi5OozTT0IjejqoMM+FZ/OvFsywxFy8aVc83J7do4S1P xd4XPiO9IOjpbgibULu7xjrZglJNvDX7W5uWs5JZGmm3EXiJL6ewzBMZQdsp/vKj7TAa Ie4EAslzE6b5c5QFE/1ykcpfzyijoNeeOrYRjZepJWUVDHCNq1fKr6byhMFjqk4gVlai 43IA== X-Gm-Message-State: AIkVDXK/WhUQU/Nt+VBa1UG9uXE2j4huILthJswbMdGOhicsaeZsO/So5AfKjHFs5PDa0uQ7 X-Received: by 10.31.61.87 with SMTP id k84mr13192579vka.162.1484579871262; Mon, 16 Jan 2017 07:17:51 -0800 (PST) Received: from alvin.alvh.no-ip.org ([181.42.254.77]) by smtp.gmail.com with ESMTPSA id 71sm5413357uag.19.2017.01.16.07.17.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jan 2017 07:17:50 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id CDE5E15D8; Mon, 16 Jan 2017 12:17:46 -0300 (CLST) Date: Mon, 16 Jan 2017 12:17:46 -0300 From: Alvaro Herrera To: Andres Freund Cc: Tom Lane , pgsql-hackers@postgresql.org Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) Message-ID: <20170116151746.smipap4c6pcxn24e@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170116083316.2izqrxbvmyalazac@alap3.anarazel.de> User-Agent: NeoMutt/20161104 (1.7.1) X-Pg-Spam-Score: -2.6 (--) 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 Andres Freund wrote: > That worked quite well. So we have a few questions, before I clean this > up: > > - For now the node is named 'Srf' both internally and in explain - not > sure if we want to make that something longer/easier to understand for > others? Proposals? TargetFunctionScan? SetResult? > > - We could alternatively add all this into the Result node - it's not > actually a lot of new code, and most of that is boilerplate stuff > about adding a new node. I'm ok with both. Hmm. I wonder if your stuff could be used as support code for XMLTABLE[1]. Currently it has a bit of additional code of its own, though admittedly it's very little code executor-side. Would you mind sharing a patch, or more details on how it works? [1] https://www.postgresql.org/message-id/CAFj8pRA_KEukOBXvS4V-imoEEsXu0pD0AsHV0-MwRFDRWte8Lg@mail.gmail.com > - I continued with the division of Labor that Tom had set up, so we're > creating one Srf node for each "nested" set of SRFs. We'd discussed > nearby to change that for one node/path for all nested SRFs, partially > because of costing. But I don't like the idea that much anymore. The > implementation seems cleaner (and probably faster) this way, and I > don't think nested targetlist SRFs are something worth optimizing > for. Anybody wants to argue differently? Nested targetlist SRFs make my head spin. I suppose they may have some use, but where would you really want this: alvherre=# select generate_series(1, generate_series(2, 4)); generate_series ───────────────── 1 2 1 2 3 1 2 3 4 (9 filas) instead of the much more sensible alvherre=# select i, j from generate_series(2, 4) i, generate_series(1, i) j; i │ j ───┼─── 2 │ 1 2 │ 2 3 │ 1 3 │ 2 3 │ 3 4 │ 1 4 │ 2 4 │ 3 4 │ 4 (9 filas) ? If supporting the former makes it harder to support/optimize more reasonable cases, it seems fair game to leave them behind. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers