2014-12-18 19:35 GMT+07:00 Fujii Masao <[email protected]>:
> On Mon, Dec 15, 2014 at 2:38 PM, Andrew Gierth
> <[email protected]> wrote:
> > I was thinking something like this, added just after that para:
> >
> > <warning>
> > <para>
> > While the actual arguments to the function remain unchanged between
> > calls, if you detoast the argument values (which is normally done
> > transparently by the
> > <function>PG_GETARG_<replaceable>xxx</replaceable></function>
> macro)
> > in the transient context then the detoasted copies will be freed on
> > each cycle. Accordingly, if you keep references to such values in
> > your <structfield>user_fctx</>, you must either copy them into the
> > <structfield>multi_call_memory_ctx</> after detoasting, or ensure
> > that you detoast the values only in that context.
> > </para>
> > </warning>
>
> I'm OK with this.
>
Wrapping the doc changes in a patch. Will add to next commitfest so it
won't be lost.
--
Ali Akbar
*** a/doc/src/sgml/xfunc.sgml
--- b/doc/src/sgml/xfunc.sgml
***************
*** 2986,2991 **** SRF_RETURN_DONE(funcctx)
--- 2986,3005 ----
<structfield>multi_call_memory_ctx</> while doing the first-call setup.
</para>
+ <warning>
+ <para>
+ While the actual arguments to the function remain unchanged between
+ calls, if you detoast the argument values (which is normally done
+ transparently by the
+ <function>PG_GETARG_<replaceable>xxx</replaceable></function> macro)
+ in the transient context then the detoasted copies will be freed on
+ each cycle. Accordingly, if you keep references to such values in
+ your <structfield>user_fctx</>, you must either copy them into the
+ <structfield>multi_call_memory_ctx</> after detoasting, or ensure
+ that you detoast the values only in that context.
+ </para>
+ </warning>
+
<para>
A complete pseudo-code example looks like the following:
<programlisting>
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers