|
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 $ --> |
2 | 2 |
|
3 | 3 | <sect1 id="xfunc"> |
4 | 4 | <title>User-Defined Functions</title> |
@@ -3034,11 +3034,12 @@ my_set_returning_function(PG_FUNCTION_ARGS) |
3034 | 3034 | { |
3035 | 3035 | FuncCallContext *funcctx; |
3036 | 3036 | Datum result; |
3037 | | - MemoryContext oldcontext; |
3038 | 3037 | <replaceable>further declarations as needed</replaceable> |
3039 | 3038 |
|
3040 | 3039 | if (SRF_IS_FIRSTCALL()) |
3041 | 3040 | { |
| 3041 | + MemoryContext oldcontext; |
| 3042 | + |
3042 | 3043 | funcctx = SRF_FIRSTCALL_INIT(); |
3043 | 3044 | oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); |
3044 | 3045 | /* One-time setup code appears here: */ |
@@ -3088,9 +3089,9 @@ retcomposite(PG_FUNCTION_ARGS) |
3088 | 3089 | TupleDesc tupdesc; |
3089 | 3090 | AttInMetadata *attinmeta; |
3090 | 3091 |
|
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 | + { |
3094 | 3095 | MemoryContext oldcontext; |
3095 | 3096 |
|
3096 | 3097 | /* create a function context for cross-call persistence */ |
|