Commit 1bc9e985 authored by Tom Lane's avatar Tom Lane

SendFunctionResult should take care to detoast varlena results.

parent 9f1f2bfb
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.55 2003/01/01 21:57:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.56 2003/01/07 22:32:10 tgl Exp $
* *
* NOTES * NOTES
* This cruft is the server side of PQfn. * This cruft is the server side of PQfn.
...@@ -97,7 +97,7 @@ SendFunctionResult(Datum retval, bool retbyval, int retlen) ...@@ -97,7 +97,7 @@ SendFunctionResult(Datum retval, bool retbyval, int retlen)
{ /* by-reference ... */ { /* by-reference ... */
if (retlen == -1) if (retlen == -1)
{ /* ... varlena */ { /* ... varlena */
struct varlena *v = (struct varlena *) DatumGetPointer(retval); struct varlena *v = PG_DETOAST_DATUM(retval);
pq_sendint(&buf, VARSIZE(v) - VARHDRSZ, VARHDRSZ); pq_sendint(&buf, VARSIZE(v) - VARHDRSZ, VARHDRSZ);
pq_sendbytes(&buf, VARDATA(v), VARSIZE(v) - VARHDRSZ); pq_sendbytes(&buf, VARDATA(v), VARSIZE(v) - VARHDRSZ);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment