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 1qlCPN-001hrt-LO for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 18:03:41 +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 1qlCPM-00E04B-BZ for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 18:03:40 +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 1qlCPM-00E03t-08 for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 18:03:40 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qlCPJ-006mMz-Ee for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 18:03:38 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-59c07cf02ebso115657217b3.1 for ; Tue, 26 Sep 2023 11:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695751416; x=1696356216; darn=lists.postgresql.org; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=9wFi0ATQ+qqusbIPSByda8qgk+3uqj0bU7D/e2d4ZMw=; b=PAgiClIAmYHbYmTP3W8eOmOfJ5/nAERQGHP7iYAjaj/dIPb0V653Tr6cc5yzN0rks8 8l/ZZ5I81ghNAFpdPPXxVjSU+Ep81r6XK3QZ6CGzohxhWjRUbkmQElv61k9z+40qaouP FWjJMbkXiWGyx9InppLT31sJ8z4m7R0VAvCnBX9BVvW3XeSLapxhim7DaseA9+urhEif JRYvAfoZQEUOiHfoDRF0nWePQusw7X395A4N/pejfn1BUV2EDDWHHUNQo9Kz7usU7ZZr XDatwsyJIGjr/reXoHdPS5t3bSrNdt+HTaCxCKsNqWe8lKC1Q06zo5Zycv0QlYRAwYYu So1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695751416; x=1696356216; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=9wFi0ATQ+qqusbIPSByda8qgk+3uqj0bU7D/e2d4ZMw=; b=peK9vYy1hlNHgn5fXxhna8UiQcw88PU8bmbuQInyo6OpbN2tkKSWj1IuPz774zgudS nQLDmRMQhCEbphbyN6Lw123ZuLwwBlsDi+rjQY/yNHedj+gWARsDW7/V1AU7+truHCWn coAUAI6Ug9oHRPovwRNSRBb8+dBbT2Y5WCTiA/0d3weWxDFXbq41jqxTyj8qQBPOQ1md A4HnKIeqDOH5spGOb+4jNFYD9kXkeFB3R2DYj3+LRZiSRQvsQ01yVSHzlLRboDn3Iljc Bpw3ILKKZdCrQ5KqWCELwExPfCaUHDcXLtLoNOUcbkWEXuK/8rilvi4HiKdrlin8mKDr TP3A== X-Gm-Message-State: AOJu0YyMTzxe6Vjcl1BZRgucg8Y/wtJTsXT+ZDGYg/X//t0ApValORsp Wiz+bcLmi6eSwGG9tqj7eb67zIJIYzo= X-Google-Smtp-Source: AGHT+IEVYyWaeOi9Bg0D11CFLiNuauVu37iW3whcRoPWsRvoAiA3wbhwJ383MhrN5UpzVP/y7EPl5w== X-Received: by 2002:a0d:f685:0:b0:576:93f1:d118 with SMTP id g127-20020a0df685000000b0057693f1d118mr10208633ywf.2.1695751416151; Tue, 26 Sep 2023 11:03:36 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:fd72:b8a9:e719:a28b? ([2600:1700:bd2c:b810:fd72:b8a9:e719:a28b]) by smtp.googlemail.com with ESMTPSA id m128-20020a0de386000000b0059b50f126fbsm3112169ywe.114.2023.09.26.11.03.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Sep 2023 11:03:35 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------LKP5mk4jb4yrTAnUomI0F3ej" Message-ID: <73c7a357-62fe-3274-7f27-7ef9adc3b9b5@gmail.com> Date: Tue, 26 Sep 2023 13:03:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Ad hoc SETOF type definition? Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <9707e21e-eed3-3c06-821e-e935eab4c098@gmail.com> <432138.1695750386@sss.pgh.pa.us> From: Ron In-Reply-To: <432138.1695750386@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------LKP5mk4jb4yrTAnUomI0F3ej Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/26/23 12:46, Tom Lane wrote: > Ron writes: >> Is there a way to define the SETOF record on the fly, like you do with >> RETURNS TABLE (f1 type1, f2 type2)? > Doesn't RETURNS TABLE meet the need already? That rationale means that RETURN SETOF is not needed, and can be removed from Pg, since "RETURNS TABLE meet the need already". But of course there /are/ times when RETURN SETOF /is/ useful. So... can ad hoc SETOF definitions be created in the function definition, or is CREATE TYPE the only way to do it? -- Born in Arizona, moved to Babylonia. --------------LKP5mk4jb4yrTAnUomI0F3ej Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit On 9/26/23 12:46, Tom Lane wrote:
Ron <ronljohnsonjr@gmail.com> writes:
Is there a way to define the SETOF record on the fly, like you do with 
RETURNS TABLE (f1 type1, f2 type2)?
Doesn't RETURNS TABLE meet the need already?

That rationale means that RETURN SETOF is not needed, and can be removed from Pg, since "RETURNS TABLE meet the need already".

But of course there are times when RETURN SETOF is useful.

So... can ad hoc SETOF definitions be created in the function definition, or is CREATE TYPE the only way to do it?

--
Born in Arizona, moved to Babylonia.
--------------LKP5mk4jb4yrTAnUomI0F3ej--