]> granicus.if.org Git - postgresql/commitdiff
In SRF example, move oldcontext variable definition into the FIRSTCALL
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 30 Nov 2009 15:49:35 +0000 (15:49 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 30 Nov 2009 15:49:35 +0000 (15:49 +0000)
branch, which is how most actual code is actually structured.  Also fix
slight whitespace misalignment.

doc/src/sgml/xfunc.sgml

index 7a5fa4a0d9099da37f6d79eafc24ce10282b0c5c..b0ef51c7df6dd92c0d2f976b8249f7e2be92593f 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.141 2009/11/23 21:41:20 petere Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.142 2009/11/30 15:49:35 petere Exp $ -->
 
  <sect1 id="xfunc">
   <title>User-Defined Functions</title>
@@ -3034,11 +3034,12 @@ my_set_returning_function(PG_FUNCTION_ARGS)
 {
     FuncCallContext  *funcctx;
     Datum             result;
-    MemoryContext     oldcontext;
     <replaceable>further declarations as needed</replaceable>
 
     if (SRF_IS_FIRSTCALL())
     {
+        MemoryContext oldcontext;
+
         funcctx = SRF_FIRSTCALL_INIT();
         oldcontext = MemoryContextSwitchTo(funcctx-&gt;multi_call_memory_ctx);
         /* One-time setup code appears here: */
@@ -3088,9 +3089,9 @@ retcomposite(PG_FUNCTION_ARGS)
     TupleDesc            tupdesc;
     AttInMetadata       *attinmeta;
 
-     /* stuff done only on the first call of the function */
-     if (SRF_IS_FIRSTCALL())
-     {
+    /* stuff done only on the first call of the function */
+    if (SRF_IS_FIRSTCALL())
+    {
         MemoryContext   oldcontext;
 
         /* create a function context for cross-call persistence */