Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 217B42E01B0 for ; Wed, 28 Nov 2007 17:48:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 23381-02 for ; Wed, 28 Nov 2007 17:48:14 -0400 (AST) Received: from momjian.us (momjian.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id BB4F82E0146 for ; Wed, 28 Nov 2007 17:48:17 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id lASLlxR10356; Wed, 28 Nov 2007 16:47:59 -0500 (EST) From: Bruce Momjian Message-Id: <200711282147.lASLlxR10356@momjian.us> Subject: Re: Two fixes for plpgsql.sgml In-Reply-To: <20071128214036.GW5118@alvh.no-ip.org> To: Alvaro Herrera Date: Wed, 28 Nov 2007 16:47:59 -0500 (EST) CC: Tom Lane , Guillaume Lelarge , Neil Conway , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/113 X-Sequence-Number: 4646 Alvaro Herrera wrote: > Bruce Momjian wrote: > > > --- 132,142 ---- > > > > > > > > ! 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 > > ! RETURN NEXT for each desired element of the result set, > > ! or by using RETURN QUERY to output the result of > > evaluating a query. > > > > 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: > > PL/pgSQL functions can also be declared to return > a set (or 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: PL/pgSQL functions can also be declared to return a set (or table) of any data type that can be returned as a single instance. Such a function generates its output by executing RETURN NEXT for each desired element of the result set, or by using RETURN QUERY to output the result of evaluating a query. -- Bruce Momjian http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +