diff options
| author | Fujii Masao <fujii@postgresql.org> | 2015-02-26 15:48:07 +0900 |
|---|---|---|
| committer | Fujii Masao <fujii@postgresql.org> | 2015-02-26 15:48:07 +0900 |
| commit | a7920b872fff36668a2d33157609024b851b5c2e (patch) | |
| tree | c2d9968099af04f40ebd1641e99f5dfcd3cdb463 /doc/src | |
| parent | f5ef00aed4c39645716cabb2e4cf1ef3598fcde7 (diff) | |
Add note about how to make the SRF detoasted arguments live accross calls.
Andrew Gierth and Ali Akbar
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/xfunc.sgml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 97a56562d3e..b85f2adc453 100644 --- 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> |
