Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfd4O-0002Mn-GM for pgsql-general@arkaria.postgresql.org; Thu, 19 Nov 2020 06:05:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kfd3r-0002u3-Mf for pgsql-general@arkaria.postgresql.org; Thu, 19 Nov 2020 06:04:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfd3r-0002tw-DB for pgsql-general@lists.postgresql.org; Thu, 19 Nov 2020 06:04:51 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kfd3l-0005mz-7O for pgsql-general@lists.postgresql.org; Thu, 19 Nov 2020 06:04:48 +0000 Received: by mail-wm1-x332.google.com with SMTP id p19so5536166wmg.0 for ; Wed, 18 Nov 2020 22:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9/hCGekdROu+NYjxhHXv3udRSToXB/IgvDQE+xbQVeM=; b=Evmdc8BmPKjWQTkCINbaIZ5naXur4YeKvy8lTEMOrDcMK52wuJjwOh9EkXwnHBO4AK NutlEf/jD9ddRbLDvdSsOVAuNywUg8gMuO5aUvlVGeJPoHqMXNq/wZHSQ/EWhu8w+ioM nJeTSss+/dSsdnsey3OvLq+dpH3vXtR2c9BhKuk9OT6ythyCzHj1wMnmB6pD0bBDynY4 ky8JLQC+pkclofO2WayEmu/3tJ/xwYXWBHmfDTgFm4qus9rZMYBAl1AN6SyRdQsuSukB GhefcBE7c1Rx4EUCggsM9Qsl710cMxrkcyZmXJE3VTy//acERchJKH2DZm84Pk57BGhM ioGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9/hCGekdROu+NYjxhHXv3udRSToXB/IgvDQE+xbQVeM=; b=qA8BabI+12DM7r+ZRPznNA+4vghIuIUfATwZ9TbOiApaXxolDBOTGyBrs8YtuRlebe 7yo9KPJpAEZjNmbTlKBwTTR4Fc/Jeh1fBLiTsgY+3dToLOuYucCpn2Pf81Smt5gRzcvK 8beIz6SYFnkHk27iDi1ID60t9sMr6zyIik4PPlM9hCPSktGzqNBA24xsQ8BKAdGOxyIh I9ciGC0lOgV1MLVCmOHBCZH6ZgfIxOnT/DsmF2JD5CjzW79JEZnfxYC++5IB6uxr753U BT7ApjbcIxbyFjBYsehuEuIdzCYBW4LbeSEmk0DtvKvbM4e1lFcnnQqlgBM+SLTI4ATF mV7A== X-Gm-Message-State: AOAM5311xj1r27SfLS9AhaJiWQh47cioQ6LwnwzVHEJkb60hd/dYXAam RtdeWjI6b8KPBrv1gmufoIU= X-Google-Smtp-Source: ABdhPJwrfxyVhP/yC+3nfjG9cJwpgEgtJSfY0RHI+JwqZci9oMhaClvTXl0e2LTPLcJoKHwFG/znMg== X-Received: by 2002:a7b:c841:: with SMTP id c1mr2555323wml.31.1605765884381; Wed, 18 Nov 2020 22:04:44 -0800 (PST) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id g11sm37365151wrq.7.2020.11.18.22.04.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2020 22:04:43 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\)) Subject: Re: create type with %type or %rowtype From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: Date: Thu, 19 Nov 2020 07:04:43 +0100 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <5EABB320-084A-42CD-8610-5BF6A37DE811@gmail.com> References: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se> <82b59d98-bc35-7212-b950-45ff585f3b12@taljaren.se> <75e98bba-afa1-5c7a-f6a1-434fac52e4a0@aklaver.com> To: Post Gresql X-Mailer: Apple Mail (2.3654.20.0.2.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, > On 18. Nov, 2020, at 22:08, Post Gresql = wrote: >=20 > I might be stupid, but where in the document for create function does = it say that the return type can be a table? >=20 > =46rom the doc for version 13 = https://www.postgresql.org/docs/13/sql-createfunction.html >=20 > "rettype > The return data type (optionally schema-qualified). The return type = can be a base, composite, or domain type, or can reference the type of a = table column." right in the syntax: CREATE [ OR REPLACE ] FUNCTION name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | =3D } = default_expr ] [, ...] ] ) [ RETURNS rettype | RETURNS TABLE ( column_name column_type [, ...] ) ] "RETURNS TABLE(...)" is probably what you're looking for? Cheers, Paul=