Re: Two fixes for plpgsql.sgml

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Neil Conway <neilc(at)samurai(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: Two fixes for plpgsql.sgml
Date: 2007-11-28 21:47:59
Message-ID: 200711282147.lASLlxR10356@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Alvaro Herrera wrote:
> Bruce Momjian wrote:
>
> > --- 132,142 ----
> > </para>
> >
> > <para>
> > ! <application>PL/pgSQL</> functions can also be declared to return a
> > ! group of values, either as a single row, or a group of rows, like a
> > ! table. Such a function generates its output by executing
> > ! <command>RETURN NEXT</> for each desired element of the result set,
> > ! or by using <command>RETURN QUERY</> to output the result of
> > evaluating a query.
> > </para>
>
> Hmm, ISTM the correct terminology is "set of rows". I have never heard
> of "a group of rows". It seems to me the easiest way out of the problem
> would have been substituting the commas in the original with parens:
>
> <application>PL/pgSQL</> functions can also be declared to return
> a <quote>set</> (or <quote>table</>) of any data type they can return a single
> instance of.
>
> The point of "any datatype they can return a single instance of" is that
> this can be a set of scalar values (e.g. "RETURNS SETOF int") or of a
> complex type ("RETURNS SETOF table"), or anything else they can return a
> single instance of :-P (SETOF anyelement? SETOF table%TYPE?)

Good idea, updated:

<application>PL/pgSQL</> functions can also be declared to return
a <quote>set</> (or table) of any data type that can be returned as
a single instance. Such a function generates its output by executing
<command>RETURN NEXT</> for each desired element of the result
set, or by using <command>RETURN QUERY</> to output the result of
evaluating a query.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2007-11-28 22:17:38 Re: Partition: use triggers instead of rules
Previous Message Alvaro Herrera 2007-11-28 21:40:36 Re: Two fixes for plpgsql.sgml