Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlEgc-001rqF-3g for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 20:29:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qlEga-00Eqbj-Cr for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 20:29:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlEgY-00Eqb2-By for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 20:29:35 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlEgQ-006np5-Ja for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 20:29:33 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 417D65C255D; Tue, 26 Sep 2023 16:29:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 26 Sep 2023 16:29:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1695760165; x=1695846565; bh=r0ges6kP2Btsl68CzmXTnn+QGO4A5ktJz1U jJjB0Hks=; b=CwCVcpRL/EePlk86i2Fn3EINdWoCrxhoYx5QcK/lzq1g+iiteqz +X6ZQU8S2JcFM7vpDvP8qdPcQrKj7i0MZ6Bgom3j0bFJ/eYBU8roQboxfqgipqGq 3WEHwwgSyUaWQNyAtKXMrjnnf2u/bBrid3B8shZE/3056+9lvA9d7qJaCNBWUTUG QZRcaG1D7SLzFdUtAbx60xwM3GpkzvfPv86L0uI9TAQ1FSId+/AXU3UBzO+bj+v+ gT+mjIHwb9Z1LRRWpYpy5/TI9NW9kFRUtcfEvNQ50A3/KuLrbSydkczbu+JjFOlI tPbfCE+Kdwnl/5wtHSoyhBs22o4E8WGUZew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1695760165; x= 1695846565; bh=r0ges6kP2Btsl68CzmXTnn+QGO4A5ktJz1UjJjB0Hks=; b=h vBaY+sj6uxcMKK8OskbxX/pFFYpsu+nmRP10bRj7O2UXKzzv/ZOGbsXI9GmM5v2k gApR9yPwcIowcYFP4d4t8KVWc3pD7A0erEMN0TNFPI+QIlLO5TenxJ1U+p1xeD3E 0XzA+W/IE8dPu3mGd492EXVzD6nXcFNEs+X2nEWjcV5KsSoSqjTlgFE0S5fxBGLX 5m4wUaqFhfzRI+z74jGOLdwJx81bhCBY9K/888WWHByrQxbaotq6WL3rzZ1MEeQz EjydIfbiBMoQUYdzx40iq+iWotHbRXrpDkpyxNSs2mvLoX4NKIgIGKFyRy+cobHw FEY6xdBnI89wrO2zVaQ+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvjedrtddtgdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtje ertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepiedvhfeihe ehgeeuieeljeeitedtjeehudegfeelkedvleekhedtgfeiffefkedunecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Sep 2023 16:29:24 -0400 (EDT) Message-ID: <538ed08d-55ba-4a51-8e46-4e424aaebb3c@aklaver.com> Date: Tue, 26 Sep 2023 13:29:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Ad hoc SETOF type definition? To: Ron , pgsql-general@lists.postgresql.org References: <9707e21e-eed3-3c06-821e-e935eab4c098@gmail.com> <432138.1695750386@sss.pgh.pa.us> <73c7a357-62fe-3274-7f27-7ef9adc3b9b5@gmail.com> <436021.1695752103@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/26/23 12:30, Ron wrote: > On 9/26/23 13:15, Tom Lane wrote: >> Ron writes: >>> On 9/26/23 12:46, Tom Lane wrote: >> I'm not really sure what functionality you think is missing from RETURNS >> TABLE, granting that you do want to return a set of rows and not exactly >> one row. > > There might be some other logic in the body of the FOR loop that is not > practical to embed in the body of the SELECT statement. I think you are conflating RETURNS TABLE and RETURN QUERY. You can build a 'TABLE' from variables outside of a query. -- Adrian Klaver adrian.klaver@aklaver.com