pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedTwo fixes for plpgsql.sgml
9+ messages / 5 participants
[nested] [flat]
* Two fixes for plpgsql.sgml
@ 2007-11-28 07:17 Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 1 reply; 9+ messages in thread
From: Guillaume Lelarge @ 2007-11-28 07:17 UTC (permalink / raw)
To: pgsql-docs
Hi,
This patch fixes two issues on plpgsql.sgml. Please review them
carefully, at least the second one. Thanks.
Regards.
PS : this patch should be in context diff if my .cvsrc is correctly set
up... at least, it doesn't look like my previous patch :)
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
Attachments:
plpgsql.patch (text/x-patch, 1.5K) download
Index: doc/src/sgml/plpgsql.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v
retrieving revision 1.117
diff -c -r1.117 plpgsql.sgml
*** doc/src/sgml/plpgsql.sgml 26 Oct 2007 01:11:09 -0000 1.117
--- doc/src/sgml/plpgsql.sgml 28 Nov 2007 07:11:58 -0000
***************
*** 133,139 ****
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or table, of any data type they can return a single
instance of. 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
--- 133,139 ----
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or table, or any data type they can return a single
instance of. 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
***************
*** 1428,1434 ****
WHERE fooid > 0
LOOP
-- can do some processing here
! RETURN NEXT r; -- return next row of SELECT
END LOOP;
RETURN;
END
--- 1428,1434 ----
WHERE fooid > 0
LOOP
-- can do some processing here
! RETURN NEXT r; -- return current row of SELECT
END LOOP;
RETURN;
END
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 09:34 Neil Conway <neilc@samurai.com>
parent: Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 1 reply; 9+ messages in thread
From: Neil Conway @ 2007-11-28 09:34 UTC (permalink / raw)
To: Guillaume Lelarge <guillaume@lelarge.info>; +Cc: pgsql-docs
On Wed, 2007-11-28 at 08:17 +0100, Guillaume Lelarge wrote:
> This patch fixes two issues on plpgsql.sgml.
The first hunk seems like a regression to me: AFAICS the current
phrasing is what is intended.
*** 133,139 ****
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or table, of any data type they can return a
single
instance of. 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
--- 133,139 ----
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or table, or any data type they can return a
single
instance of. 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
-Neil
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 09:48 Guillaume Lelarge <guillaume@lelarge.info>
parent: Neil Conway <neilc@samurai.com>
0 siblings, 1 reply; 9+ messages in thread
From: Guillaume Lelarge @ 2007-11-28 09:48 UTC (permalink / raw)
To: Neil Conway <neilc@samurai.com>; +Cc: pgsql-docs
Neil Conway a écrit :
> On Wed, 2007-11-28 at 08:17 +0100, Guillaume Lelarge wrote:
>> This patch fixes two issues on plpgsql.sgml.
>
> The first hunk seems like a regression to me: AFAICS the current
> phrasing is what is intended.
>
> *** 133,139 ****
>
> <para>
> <application>PL/pgSQL</> functions can also be declared to return
> ! a <quote>set</>, or table, of any data type they can return a
> single
> instance of. 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
> --- 133,139 ----
>
> <para>
> <application>PL/pgSQL</> functions can also be declared to return
> ! a <quote>set</>, or table, or any data type they can return a
> single
> instance of. 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
>
That's why I said that it needs to be reviewed carefully :) It just
means I didn't understand the sentence. Can you explain why the last
part is needed ? (the part that starts with "of any data type...")
Thanks.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 20:15 Bruce Momjian <bruce@momjian.us>
parent: Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 1 reply; 9+ messages in thread
From: Bruce Momjian @ 2007-11-28 20:15 UTC (permalink / raw)
To: Guillaume Lelarge <guillaume@lelarge.info>; +Cc: Neil Conway <neilc@samurai.com>; pgsql-docs
Guillaume Lelarge wrote:
> Neil Conway a ?crit :
> > On Wed, 2007-11-28 at 08:17 +0100, Guillaume Lelarge wrote:
> >> This patch fixes two issues on plpgsql.sgml.
> >
> > The first hunk seems like a regression to me: AFAICS the current
> > phrasing is what is intended.
> >
> > *** 133,139 ****
> >
> > <para>
> > <application>PL/pgSQL</> functions can also be declared to return
> > ! a <quote>set</>, or table, of any data type they can return a
> > single
> > instance of. 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
> > --- 133,139 ----
> >
> > <para>
> > <application>PL/pgSQL</> functions can also be declared to return
> > ! a <quote>set</>, or table, or any data type they can return a
> > single
> > instance of. 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
> >
>
> That's why I said that it needs to be reviewed carefully :) It just
> means I didn't understand the sentence. Can you explain why the last
> part is needed ? (the part that starts with "of any data type...")
Agreed. I couldn't find any value to that phrase and couldn't find better
wording, so I removed it. Patch attached and applied.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachments:
/rtmp/diff (text/x-diff, 1.5K) download
Index: doc/src/sgml/plpgsql.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v
retrieving revision 1.118
diff -c -c -r1.118 plpgsql.sgml
*** doc/src/sgml/plpgsql.sgml 28 Nov 2007 15:42:31 -0000 1.118
--- doc/src/sgml/plpgsql.sgml 28 Nov 2007 20:11:15 -0000
***************
*** 133,141 ****
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or table, of any data type they can return a single
! instance of. 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>
--- 133,140 ----
<para>
<application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or 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>
***************
*** 1428,1434 ****
WHERE fooid > 0
LOOP
-- can do some processing here
! RETURN NEXT r; -- return next row of SELECT
END LOOP;
RETURN;
END
--- 1427,1433 ----
WHERE fooid > 0
LOOP
-- can do some processing here
! RETURN NEXT r; -- return current row of SELECT
END LOOP;
RETURN;
END
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 20:38 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 9+ messages in thread
From: Tom Lane @ 2007-11-28 20:38 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Guillaume Lelarge <guillaume@lelarge.info>; Neil Conway <neilc@samurai.com>; pgsql-docs
Bruce Momjian <bruce@momjian.us> writes:
> Agreed. I couldn't find any value to that phrase and couldn't find better
> wording, so I removed it. Patch attached and applied.
This is not an improvement.
The point of the original wording is that you have to say
RETURNS SETOF sometype
you can't just say, eg,
RETURNS SET
Your new wording would lead the reader to the assumption that he can
just declare a function as returning "set".
Please revert the change.
regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 20:57 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 9+ messages in thread
From: Bruce Momjian @ 2007-11-28 20:57 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Guillaume Lelarge <guillaume@lelarge.info>; Neil Conway <neilc@samurai.com>; pgsql-docs
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Agreed. I couldn't find any value to that phrase and couldn't find better
> > wording, so I removed it. Patch attached and applied.
>
> This is not an improvement.
>
> The point of the original wording is that you have to say
> RETURNS SETOF sometype
> you can't just say, eg,
> RETURNS SET
>
> Your new wording would lead the reader to the assumption that he can
> just declare a function as returning "set".
>
> Please revert the change.
I found the original confusing, as did the author, so I updated the docs
again.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachments:
/rtmp/diff (text/x-diff, 1.1K) download
Index: plpgsql.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v
retrieving revision 1.119
diff -c -r1.119 plpgsql.sgml
*** plpgsql.sgml 28 Nov 2007 20:13:06 -0000 1.119
--- plpgsql.sgml 28 Nov 2007 20:56:17 -0000
***************
*** 132,141 ****
</para>
<para>
! <application>PL/pgSQL</> functions can also be declared to return
! a <quote>set</>, or 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>
--- 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>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 21:40 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 9+ messages in thread
From: Alvaro Herrera @ 2007-11-28 21:40 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Guillaume Lelarge <guillaume@lelarge.info>; Neil Conway <neilc@samurai.com>; pgsql-docs
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?)
--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"World domination is proceeding according to plan" (Andrew Morton)
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 21:47 Bruce Momjian <bruce@momjian.us>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 1 reply; 9+ messages in thread
From: Bruce Momjian @ 2007-11-28 21:47 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Guillaume Lelarge <guillaume@lelarge.info>; Neil Conway <neilc@samurai.com>; 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@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Two fixes for plpgsql.sgml
@ 2007-11-28 22:42 Guillaume Lelarge <guillaume@lelarge.info>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 9+ messages in thread
From: Guillaume Lelarge @ 2007-11-28 22:42 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Tom Lane <tgl@sss.pgh.pa.us>; Neil Conway <neilc@samurai.com>; pgsql-docs
Bruce Momjian a écrit :
> Alvaro Herrera wrote:
>>[...]
>> 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.
>
Great. Now I better understand this part. Thank you all.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2007-11-28 22:42 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28 07:17 Two fixes for plpgsql.sgml Guillaume Lelarge <guillaume@lelarge.info>
2007-11-28 09:34 ` Neil Conway <neilc@samurai.com>
2007-11-28 09:48 ` Guillaume Lelarge <guillaume@lelarge.info>
2007-11-28 20:15 ` Bruce Momjian <bruce@momjian.us>
2007-11-28 20:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-11-28 20:57 ` Bruce Momjian <bruce@momjian.us>
2007-11-28 21:40 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2007-11-28 21:47 ` Bruce Momjian <bruce@momjian.us>
2007-11-28 22:42 ` Guillaume Lelarge <guillaume@lelarge.info>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox