Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bb1e8be

Browse files
committed
In SRF example, move oldcontext variable definition into the FIRSTCALL
branch, which is how most actual code is actually structured. Also fix slight whitespace misalignment.
1 parent be64b3e commit bb1e8be

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.141 2009/11/23 21:41:20 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.142 2009/11/30 15:49:35 petere Exp $ -->
22

33
<sect1 id="xfunc">
44
<title>User-Defined Functions</title>
@@ -3034,11 +3034,12 @@ my_set_returning_function(PG_FUNCTION_ARGS)
30343034
{
30353035
FuncCallContext *funcctx;
30363036
Datum result;
3037-
MemoryContext oldcontext;
30383037
<replaceable>further declarations as needed</replaceable>
30393038

30403039
if (SRF_IS_FIRSTCALL())
30413040
{
3041+
MemoryContext oldcontext;
3042+
30423043
funcctx = SRF_FIRSTCALL_INIT();
30433044
oldcontext = MemoryContextSwitchTo(funcctx-&gt;multi_call_memory_ctx);
30443045
/* One-time setup code appears here: */
@@ -3088,9 +3089,9 @@ retcomposite(PG_FUNCTION_ARGS)
30883089
TupleDesc tupdesc;
30893090
AttInMetadata *attinmeta;
30903091

3091-
/* stuff done only on the first call of the function */
3092-
if (SRF_IS_FIRSTCALL())
3093-
{
3092+
/* stuff done only on the first call of the function */
3093+
if (SRF_IS_FIRSTCALL())
3094+
{
30943095
MemoryContext oldcontext;
30953096

30963097
/* create a function context for cross-call persistence */

0 commit comments

Comments
 (0)