Re: Please provide examples of rows from

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Guyren Howe <guyren(at)gmail(dot)com>, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Please provide examples of rows from
Date: 2020-09-20 00:49:53
Message-ID: 798909.1600562993@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> test=> \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 catcode "char", OUT barelabel boolean, OUT catdesc text, OUT baredesc text | func
> (1 row)

> test=> select * from pg_get_keywords() AS f(word text);
> --> ERROR: a column definition list is only allowed for functions returning "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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2020-09-20 01:38:46 Re: Please provide examples of rows from
Previous Message Bruce Momjian 2020-09-20 00:39:10 Re: Please provide examples of rows from