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 1kJnYF-0001Jg-Hp for pgsql-docs@arkaria.postgresql.org; Sun, 20 Sep 2020 00:49:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kJnYD-0006Hw-Oi for pgsql-docs@arkaria.postgresql.org; Sun, 20 Sep 2020 00:49:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJnYD-0006Hp-JF for pgsql-docs@lists.postgresql.org; Sun, 20 Sep 2020 00:49:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJnYB-0006s5-EM for pgsql-docs@lists.postgresql.org; Sun, 20 Sep 2020 00:49:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08K0nrcs798910; Sat, 19 Sep 2020 20:49:53 -0400 From: Tom Lane To: Bruce Momjian cc: "David G. Johnston" , Guyren Howe , Pg Docs Subject: Re: Please provide examples of rows from In-reply-to: <20200920003910.GA22746@momjian.us> References: <158638264419.662.2482095087061084020@wrigleys.postgresql.org> <20200904014618.GB13932@momjian.us> <20200920003910.GA22746@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Sat, 19 Sep 2020 20:39:10 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <798908.1600562993.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 19 Sep 2020 20:49:53 -0400 Message-ID: <798909.1600562993@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bruce Momjian writes: > test=3D> \df pg_get_keywords > List= of functions > Schema | Name | Result data type | = Argument data types = | Type > ------------+-----------------+------------------+---------------------= --------------------------------------------------------------------------= +------ > pg_catalog | pg_get_keywords | SETOF record | OUT word text, OUT c= atcode "char", OUT barelabel boolean, OUT catdesc text, OUT baredesc text = | func > (1 row) > test=3D> select * from pg_get_keywords() AS f(word text); > --> ERROR: a column definition list is only allowed for functions retur= ning "record" > LINE 1: select * from pg_get_keywords() AS f(word text); Yeah, this error message needs some help. With a function having multiple OUT parameters, the prorettype is indeed "record", but the specific record type is implied by the OUT parameters so you do not need to (and can't) specify it in the query. The point of the AS feature is to allow specifying the concrete record type for record-returning functions that don't have a predefined result record type, like dblink(). I think this error text was written before we had multiple OUT parameters, so it was okay at the time; but now it needs to be more precise. regards, tom lane