git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5ef00a)
Add note about how to make the SRF detoasted arguments live accross calls.
2015年2月26日 06:48:07 +0000 (15:48 +0900)
2015年2月26日 06:48:07 +0000 (15:48 +0900)
Andrew Gierth and Ali Akbar


diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 97a56562d3e40293b8bee91df37de90f974844a2..b85f2adc453eb5bd862d5b317952fee5eb738ede 100644 (file)
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -2981,6 +2981,20 @@ SRF_RETURN_DONE(funcctx)
<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>
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /